mirror of
https://github.com/lowdefy/lowdefy.git
synced 2025-03-31 15:20:32 +08:00
Merge pull request #1112 from lowdefy/fix-jest-es-modules
Fix jest test for es modules.
This commit is contained in:
commit
469a56f0e9
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@jest-environment-npm-27.5.1-375c740ca0-2a9e18c35a.zip
vendored
Normal file
BIN
.yarn/cache/@jest-environment-npm-27.5.1-375c740ca0-2a9e18c35a.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@jest-fake-timers-npm-27.5.1-d5ae31aa49-02a0561ed2.zip
vendored
Normal file
BIN
.yarn/cache/@jest-fake-timers-npm-27.5.1-d5ae31aa49-02a0561ed2.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@jest-globals-npm-27.5.1-b4ce1a8d04-087f97047e.zip
vendored
Normal file
BIN
.yarn/cache/@jest-globals-npm-27.5.1-b4ce1a8d04-087f97047e.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@jest-source-map-npm-27.5.1-82cd2ed5c0-4fb1e743b6.zip
vendored
Normal file
BIN
.yarn/cache/@jest-source-map-npm-27.5.1-82cd2ed5c0-4fb1e743b6.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/@jest-transform-npm-27.5.1-2c1cc049e5-a22079121a.zip
vendored
Normal file
BIN
.yarn/cache/@jest-transform-npm-27.5.1-2c1cc049e5-a22079121a.zip
vendored
Normal file
Binary file not shown.
BIN
.yarn/cache/@jest-types-npm-27.5.1-c589ce1890-d1f43cc946.zip
vendored
Normal file
BIN
.yarn/cache/@jest-types-npm-27.5.1-c589ce1890-d1f43cc946.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/babel-plugin-jest-hoist-npm-27.5.1-9fcb34fdf4-709c17727a.zip
vendored
Normal file
BIN
.yarn/cache/babel-plugin-jest-hoist-npm-27.5.1-9fcb34fdf4-709c17727a.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/diff-sequences-npm-27.5.1-29338362fa-a00db5554c.zip
vendored
Normal file
BIN
.yarn/cache/diff-sequences-npm-27.5.1-29338362fa-a00db5554c.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-changed-files-npm-27.5.1-e3b21b0242-95e9dc74c3.zip
vendored
Normal file
BIN
.yarn/cache/jest-changed-files-npm-27.5.1-e3b21b0242-95e9dc74c3.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-cli-npm-27.5.1-e801369688-6c0a69fb48.zip
vendored
Normal file
BIN
.yarn/cache/jest-cli-npm-27.5.1-e801369688-6c0a69fb48.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-config-npm-27.5.1-e70d159078-1188fd46c0.zip
vendored
Normal file
BIN
.yarn/cache/jest-config-npm-27.5.1-e70d159078-1188fd46c0.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-each-npm-27.5.1-981b49b3a7-b5a6d8730f.zip
vendored
Normal file
BIN
.yarn/cache/jest-each-npm-27.5.1-981b49b3a7-b5a6d8730f.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-environment-node-npm-27.5.1-2ecb71f8f5-0f988330c4.zip
vendored
Normal file
BIN
.yarn/cache/jest-environment-node-npm-27.5.1-2ecb71f8f5-0f988330c4.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-leak-detector-npm-27.5.1-65940ce9fd-5c96890609.zip
vendored
Normal file
BIN
.yarn/cache/jest-leak-detector-npm-27.5.1-65940ce9fd-5c96890609.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-matcher-utils-npm-27.5.1-0c47b071fb-bb2135fc48.zip
vendored
Normal file
BIN
.yarn/cache/jest-matcher-utils-npm-27.5.1-0c47b071fb-bb2135fc48.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-message-util-npm-27.5.1-6150700d58-eb6d637d14.zip
vendored
Normal file
BIN
.yarn/cache/jest-message-util-npm-27.5.1-6150700d58-eb6d637d14.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-mock-npm-27.5.1-22d1da854d-f5b5904bb1.zip
vendored
Normal file
BIN
.yarn/cache/jest-mock-npm-27.5.1-22d1da854d-f5b5904bb1.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/jest-serializer-npm-27.5.1-7cec732598-803e03a552.zip
vendored
Normal file
BIN
.yarn/cache/jest-serializer-npm-27.5.1-7cec732598-803e03a552.zip
vendored
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
.yarn/cache/pretty-format-npm-27.5.1-cd7d49696f-cf610cffcb.zip
vendored
Normal file
BIN
.yarn/cache/pretty-format-npm-27.5.1-cd7d49696f-cf610cffcb.zip
vendored
Normal file
Binary file not shown.
@ -38,7 +38,7 @@
|
||||
"clean": "rm -rf dist",
|
||||
"prepare": "yarn build",
|
||||
"swc": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
|
||||
"test": "jest --coverage"
|
||||
"test": "yarn node --experimental-vm-modules $(yarn bin jest)"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lowdefy/ajv": "4.0.0-alpha.6",
|
||||
@ -48,10 +48,12 @@
|
||||
"@lowdefy/operators": "4.0.0-alpha.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "27.5.1",
|
||||
"@lowdefy/operators-js": "4.0.0-alpha.6",
|
||||
"@swc/cli": "0.1.55",
|
||||
"@swc/core": "1.2.135",
|
||||
"@swc/jest": "0.2.17",
|
||||
"jest": "27.4.7"
|
||||
"jest": "27.5.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -13,10 +13,11 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { getFileExtension } from '@lowdefy/node-utils';
|
||||
|
||||
jest.mock('@lowdefy/node-utils', () => {
|
||||
jest.unstable_mockModule('@lowdefy/node-utils', () => {
|
||||
return {
|
||||
getFileExtension,
|
||||
readFile: jest.fn(),
|
||||
@ -25,7 +26,8 @@ jest.mock('@lowdefy/node-utils', () => {
|
||||
|
||||
test('readConfigFile', async () => {
|
||||
const nodeUtils = await import('@lowdefy/node-utils');
|
||||
nodeUtils.mockImplementation(() => Promise.resove('config value'));
|
||||
|
||||
nodeUtils.readFile.mockImplementation(() => Promise.resolve('config value'));
|
||||
const createReadConfigFile = (await import('./readConfigFile.js')).default;
|
||||
const readConfigFile = createReadConfigFile({ buildDirectory: '/build' });
|
||||
const res = await readConfigFile('file');
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import getPageConfig from './getPageConfig.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
|
@ -13,12 +13,16 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { jest } from '@jest/globals';
|
||||
import { operatorsServer } from '@lowdefy/operators-js';
|
||||
|
||||
import callRequest from './callRequest.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
import { ConfigurationError, RequestError } from '../../context/errors.js';
|
||||
|
||||
const { _date, _payload, _secret, _user } = operatorsServer;
|
||||
|
||||
console.error = () => {};
|
||||
|
||||
const mockReadConfigFile = jest.fn();
|
||||
@ -26,7 +30,14 @@ const mockTestRequest = jest.fn();
|
||||
const mockTestRequestCheckRead = jest.fn();
|
||||
const mockTestRequestCheckWrite = jest.fn();
|
||||
|
||||
mockTestRequest.schema = {};
|
||||
mockTestRequest.schema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
schemaPropString: {
|
||||
type: 'string',
|
||||
},
|
||||
},
|
||||
};
|
||||
mockTestRequestCheckRead.schema = {};
|
||||
mockTestRequestCheckWrite.schema = {};
|
||||
|
||||
@ -61,15 +72,31 @@ const connections = {
|
||||
},
|
||||
};
|
||||
|
||||
const operators = {
|
||||
_date,
|
||||
_payload,
|
||||
_secret,
|
||||
_user,
|
||||
_error: () => {
|
||||
throw new Error('Test error.');
|
||||
},
|
||||
};
|
||||
|
||||
const secrets = {
|
||||
CONNECTION: 'connectionSecret',
|
||||
REQUEST: 'requestSecret',
|
||||
};
|
||||
|
||||
const context = testContext({ connections, readConfigFile: mockReadConfigFile, secrets });
|
||||
const context = testContext({
|
||||
connections,
|
||||
readConfigFile: mockReadConfigFile,
|
||||
operators,
|
||||
secrets,
|
||||
});
|
||||
const authenticatedContext = testContext({
|
||||
connections,
|
||||
readConfigFile: mockReadConfigFile,
|
||||
operators,
|
||||
secrets,
|
||||
user: { sub: 'sub' },
|
||||
});
|
||||
@ -530,7 +557,7 @@ test('request properties operator error', async () => {
|
||||
connectionId: 'testConnection',
|
||||
auth: { public: true },
|
||||
properties: {
|
||||
willError: { _get: null },
|
||||
willError: { _error: null },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -538,9 +565,7 @@ test('request properties operator error', async () => {
|
||||
mockTestRequest.mockImplementation(defaultResolverImp);
|
||||
|
||||
await expect(callRequest(context, defaultParams)).rejects.toThrow(RequestError);
|
||||
await expect(callRequest(context, defaultParams)).rejects.toThrow(
|
||||
'Error: Operator Error: _get takes an object as params. Received: null at requestId.'
|
||||
);
|
||||
await expect(callRequest(context, defaultParams)).rejects.toThrow('Error: Test error.');
|
||||
});
|
||||
|
||||
test('connection properties operator error', async () => {
|
||||
@ -552,7 +577,7 @@ test('connection properties operator error', async () => {
|
||||
connectionId: 'testConnection',
|
||||
auth: { public: true },
|
||||
properties: {
|
||||
willError: { _get: null },
|
||||
willError: { _error: null },
|
||||
},
|
||||
},
|
||||
})
|
||||
@ -560,9 +585,7 @@ test('connection properties operator error', async () => {
|
||||
mockTestRequest.mockImplementation(defaultResolverImp);
|
||||
|
||||
await expect(callRequest(context, defaultParams)).rejects.toThrow(RequestError);
|
||||
await expect(callRequest(context, defaultParams)).rejects.toThrow(
|
||||
'Error: Operator Error: _get takes an object as params. Received: null at testConnection.'
|
||||
);
|
||||
await expect(callRequest(context, defaultParams)).rejects.toThrow('Error: Test error.');
|
||||
});
|
||||
|
||||
test('request resolver throws error', async () => {
|
||||
|
@ -13,11 +13,12 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
const mockGetMenu = jest.fn();
|
||||
jest.mock('./menus/getMenus.js', () => ({
|
||||
__esModule: true,
|
||||
jest.unstable_mockModule('./menus/getMenus.js', () => ({
|
||||
default: mockGetMenu,
|
||||
}));
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import getLowdefyGlobal from './getLowdefyGlobal.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
|
@ -13,12 +13,12 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
const mockGetMenu = jest.fn();
|
||||
jest.mock('./menus/getMenus.js', () => ({
|
||||
__esModule: true,
|
||||
jest.unstable_mockModule('./menus/getMenus.js', () => ({
|
||||
default: mockGetMenu,
|
||||
}));
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import getMenus from './getMenus.js';
|
||||
import testContext from '../../../test/testContext.js';
|
||||
|
@ -42,7 +42,7 @@
|
||||
"prepare": "yarn build",
|
||||
"start": "node dist/scripts/run.js",
|
||||
"swc": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
|
||||
"test": "jest --coverage"
|
||||
"test": "yarn node --experimental-vm-modules $(yarn bin jest)"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lowdefy/ajv": "4.0.0-alpha.6",
|
||||
@ -56,6 +56,7 @@
|
||||
"yargs": "17.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "27.5.1",
|
||||
"@lowdefy/blocks-antd": "4.0.0-alpha.6",
|
||||
"@lowdefy/blocks-basic": "4.0.0-alpha.6",
|
||||
"@lowdefy/blocks-color-selectors": "4.0.0-alpha.6",
|
||||
@ -80,7 +81,7 @@
|
||||
"@swc/cli": "0.1.55",
|
||||
"@swc/core": "1.2.135",
|
||||
"@swc/jest": "0.2.17",
|
||||
"jest": "27.4.7"
|
||||
"jest": "27.5.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import addDefaultPages from './addDefaultPages.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import buildMenu from './buildMenu.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -13,6 +13,9 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import { get } from '@lowdefy/helpers';
|
||||
import buildPages from '../buildPages.js';
|
||||
import testContext from '../../../test/testContext.js';
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import buildPages from '../buildPages.js';
|
||||
import testContext from '../../../test/testContext.js';
|
||||
|
||||
|
@ -13,6 +13,9 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import buildPages from './buildPages.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
|
@ -13,6 +13,9 @@
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import buildPages from './buildPages.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import buildRefs from './buildRefs.js';
|
||||
import testContext from '../../test/testContext.js';
|
||||
|
||||
|
@ -14,7 +14,9 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
jest.mock('@lowdefy/node-utils', () => {
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
jest.unstable_mockModule('@lowdefy/node-utils', () => {
|
||||
return {
|
||||
cleanDirectory: jest.fn(),
|
||||
};
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import testSchema from './testSchema.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writeApp from './writeApp.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writeConfig from './writeConfig.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writeConnections from './writeConnections.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writeGlobal from './writeGlobal.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writeMenus from './writeMenus.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writePages from './writePages.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
import writeRequests from './writeRequests.js';
|
||||
import testContext from '../test/testContext.js';
|
||||
|
||||
|
@ -21,4 +21,4 @@ async function asyncFn() {
|
||||
return { async: true };
|
||||
}
|
||||
|
||||
module.exports = asyncFn;
|
||||
export default asyncFn;
|
||||
|
@ -18,4 +18,4 @@ function resolver() {
|
||||
throw new Error('Test error');
|
||||
}
|
||||
|
||||
module.exports = resolver;
|
||||
export default resolver;
|
||||
|
@ -19,4 +19,4 @@ function resolver(path) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
module.exports = resolver;
|
||||
export default resolver;
|
||||
|
@ -39,4 +39,4 @@ array:
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = resolver;
|
||||
export default resolver;
|
||||
|
@ -23,4 +23,4 @@ function resolver(path, vars, context) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = resolver;
|
||||
export default resolver;
|
||||
|
@ -26,4 +26,4 @@ function transformer(obj, vars) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = transformer;
|
||||
export default transformer;
|
||||
|
@ -21,4 +21,4 @@ function transformer(obj, vars) {
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = transformer;
|
||||
export default transformer;
|
||||
|
@ -14,9 +14,10 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
import path from 'path';
|
||||
|
||||
jest.mock('@lowdefy/node-utils', () => {
|
||||
jest.unstable_mockModule('@lowdefy/node-utils', () => {
|
||||
return {
|
||||
readFile: jest.fn(),
|
||||
};
|
||||
|
@ -11,17 +11,18 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
jest.mock('@lowdefy/node-utils', () => {
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
jest.unstable_mockModule('@lowdefy/node-utils', () => {
|
||||
return {
|
||||
writeFile: jest.fn(),
|
||||
};
|
||||
});
|
||||
|
||||
const directories = { build: '/build' };
|
||||
|
||||
test('Write build artifact.', async () => {
|
||||
const nodeUtils = await import('@lowdefy/node-utils');
|
||||
nodeUtils.readFile.mockImplementation(() => Promise.resolve(null));
|
||||
nodeUtils.writeFile.mockImplementation(() => Promise.resolve(null));
|
||||
const createWriteBuildArtifact = (await import('./writeBuildArtifact.js')).default;
|
||||
|
||||
const writeBuildArtifact = createWriteBuildArtifact({ directories });
|
||||
|
@ -37,7 +37,7 @@
|
||||
"start": "yarn node ./dist/index.js",
|
||||
"prepare": "yarn build",
|
||||
"swc": "swc src --out-dir dist --config-file ../../.swcrc --delete-dir-on-start",
|
||||
"test": "FORCE_COLOR=3 jest --coverage"
|
||||
"test": "FORCE_COLOR=3 yarn node --experimental-vm-modules $(yarn bin jest)"
|
||||
},
|
||||
"dependencies": {
|
||||
"@lowdefy/helpers": "4.0.0-alpha.6",
|
||||
@ -52,10 +52,11 @@
|
||||
"uuid": "8.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "27.5.1",
|
||||
"@swc/cli": "0.1.55",
|
||||
"@swc/core": "1.2.135",
|
||||
"@swc/jest": "0.2.17",
|
||||
"jest": "27.4.7"
|
||||
"jest": "27.5.1"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
@ -28,11 +28,11 @@ import runCommand from './utils/runCommand.js';
|
||||
const packageJson = JSON.parse(
|
||||
await readFile(new URL('../package.json', import.meta.url).pathname)
|
||||
);
|
||||
const { description, version } = packageJson;
|
||||
const { description, version: cliVersion } = packageJson;
|
||||
|
||||
const program = new Command();
|
||||
|
||||
program.name('lowdefy').description(description).version(version, '-v, --version');
|
||||
program.name('lowdefy').description(description).version(cliVersion, '-v, --version');
|
||||
|
||||
program
|
||||
.command('build')
|
||||
@ -55,7 +55,7 @@ program
|
||||
'--ref-resolver <ref-resolver-function-path>',
|
||||
'Path to a JavaScript file containing a _ref resolver function to be used as the app default _ref resolver.'
|
||||
)
|
||||
.action(runCommand({ cliVersion: version })(build));
|
||||
.action(runCommand({ cliVersion, handler: build }));
|
||||
|
||||
program
|
||||
.command('dev')
|
||||
@ -83,13 +83,13 @@ program
|
||||
'--watch-ignore <paths...>',
|
||||
'A list of paths to files or directories that should be ignored by the file watcher. Globs are supported. Specify each path to watch separated by spaces.'
|
||||
)
|
||||
.action(runCommand({ cliVersion: version })(dev));
|
||||
.action(runCommand({ cliVersion, handler: dev }));
|
||||
|
||||
program
|
||||
.command('init')
|
||||
.description('Initialize a Lowdefy project.')
|
||||
.usage(`[options]`)
|
||||
.action(runCommand({ cliVersion: version })(init));
|
||||
.action(runCommand({ cliVersion, handler: init }));
|
||||
|
||||
program
|
||||
.command('start')
|
||||
@ -109,6 +109,6 @@ program
|
||||
'The package manager to use. Options are "npm" or "yarn".'
|
||||
)
|
||||
.option('--port <port>', 'Change the port the server is hosted at. Default is 3000.')
|
||||
.action(runCommand({ cliVersion: version })(start));
|
||||
.action(runCommand({ cliVersion, handler: start }));
|
||||
|
||||
program.parse(process.argv);
|
||||
|
@ -14,10 +14,11 @@
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import BatchChanges from './BatchChanges.js';
|
||||
|
||||
import { jest } from '@jest/globals';
|
||||
import { wait } from '@lowdefy/helpers';
|
||||
|
||||
import BatchChanges from './BatchChanges.js';
|
||||
|
||||
const context = {};
|
||||
|
||||
test('BatchChanges calls the provided sync function', async () => {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user