diff --git a/__TESTS_BUNDLE_SIZE__/bundleSizeTestRunner.ts b/__TESTS_BUNDLE_SIZE__/bundleSizeTestRunner.ts index fcdb9332..dc662c71 100644 --- a/__TESTS_BUNDLE_SIZE__/bundleSizeTestRunner.ts +++ b/__TESTS_BUNDLE_SIZE__/bundleSizeTestRunner.ts @@ -44,7 +44,7 @@ async function bundleSizeTestRunner():Promise { const ACTUAL_SIZE_IN_KB = Math.round(bundleInfo.size / 1024); - if (ACTUAL_SIZE_IN_KB <= EXPECTED_SIZE_IN_KB && ACTUAL_SIZE_IN_KB > ALLOWED_MIN_SIZE_IN_KB) { + if (ACTUAL_SIZE_IN_KB <= EXPECTED_SIZE_IN_KB && ACTUAL_SIZE_IN_KB >= ALLOWED_MIN_SIZE_IN_KB) { handleTestSuccess(testCases[i], ACTUAL_SIZE_IN_KB); } else { handleTestError(TEST_NAME, EXPECTED_SIZE_IN_KB, ACTUAL_SIZE_IN_KB, ALLOWED_MIN_SIZE_IN_KB); diff --git a/__TESTS__/TestUtils/createEntryMockedFS.ts b/__TESTS__/TestUtils/createEntryMockedFS.ts index 62ae64c9..f49a2578 100644 --- a/__TESTS__/TestUtils/createEntryMockedFS.ts +++ b/__TESTS__/TestUtils/createEntryMockedFS.ts @@ -1,4 +1,4 @@ -const TEST_FILE_STRUCTURE = { +export const TEST_FILE_STRUCTURE = { 'package.json': '{"fieldA":"foobar"}', dist: { bundles: { @@ -8,5 +8,3 @@ const TEST_FILE_STRUCTURE = { } } }; - -export default TEST_FILE_STRUCTURE; diff --git a/__TESTS__/unit/scripts/createEntryPoints.test.ts b/__TESTS__/unit/scripts/createEntryPoints.test.ts index 0ffc158f..e98e96fc 100644 --- a/__TESTS__/unit/scripts/createEntryPoints.test.ts +++ b/__TESTS__/unit/scripts/createEntryPoints.test.ts @@ -1,16 +1,15 @@ /* eslint @typescript-eslint/no-var-requires: 0 */ -import TEST_FILE_STRUCTURE from "../../TestUtils/createEntryMockedFS"; +const { TEST_FILE_STRUCTURE } = require('../../TestUtils/createEntryMockedFS'); const createEntryPoints = require('../../../scripts/lib/entryPointsLib'); -const mock = require('mock-fs'); +const mockFs = require('mock-fs'); const fs = require('fs'); - describe('Tests for createEntryPoints', () => { beforeEach(() => { - mock.restore(); - mock(TEST_FILE_STRUCTURE); + mockFs.restore(); + mockFs(TEST_FILE_STRUCTURE); }); it ('Creates the main entrypoint to the project', () => { @@ -38,7 +37,7 @@ describe('Tests for createEntryPoints', () => { }); afterAll(() => { - mock.restore(); + mockFs.restore(); }); }); diff --git a/package.json b/package.json index 4c06ec85..8d8757f2 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "test": "npm run test:types && npm run build && jest --coverage --reporters default && npm run test:size", "test:size": "ts-node -O '{\"module\":\"CommonJS\"}' __TESTS_BUNDLE_SIZE__/bin/bin.ts", "test:comp": "node ./scripts/updateCompliationTests.js && jest __TESTS__/compilationsOutput.test.ts --coverage", - "test:comp:service": "ts-node devTools/sanity/index.ts && jest __TESTS__/compilation.test.ts", + "test:comp:service": "ts-node -O '{\"module\":\"CommonJS\"}' devTools/sanity/index.ts && jest __TESTS__/compilation.test.ts", "test:unit": "jest --reporters default", "test:unit:watch": "jest --watch --reporters default", "test:types": "tsc --project tsconfig.test.json", @@ -16,9 +16,9 @@ "build:ESM": "tsc --project tsconfig.json --outDir dist --declaration true", "build:rollup": "rollup -c", "build:docs": "bash ./scripts/buildDocs.sh", - "build:entryPoints": "ts-node ./scripts/createEntrypoints.ts", - "build:injectPackageVersion": "ts-node ./scripts/injectPackageVersionToDistFiles.ts", - "build:updatePackageExports": "ts-node scripts/updatePackageJsonExports.ts", + "build:entryPoints": "ts-node -O '{\"module\":\"CommonJS\"}' ./scripts/createEntrypoints.ts", + "build:injectPackageVersion": "ts-node -O '{\"module\":\"CommonJS\"}' ./scripts/injectPackageVersionToDistFiles.ts", + "build:updatePackageExports": "ts-node -O '{\"module\":\"CommonJS\"}' scripts/updatePackageJsonExports.ts", "lint": "npm run lint:src && npm run lint:test", "lint:src": "eslint src --color --ext .ts", "lint:test": "eslint __TESTS__ __TESTS_BUNDLE_SIZE__ --rule 'import/extensions: [0, \"never\"]' --color --ext .ts", @@ -87,7 +87,7 @@ "ts-node": "^8.10.2", "tslib": "^2.0.0", "typedoc": "^0.17.8", - "typescript": "^3.9.3", + "typescript": "^4.2.0", "webpack": "^4.44.1" }, "exports": { diff --git a/rollup.config.js b/rollup.config.js index 4bcc5d5d..5011686d 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -21,6 +21,7 @@ export default [ resolve(), replace({ 'PACKAGE_VERSION_INJECTED_DURING_BUILD': version, + preventAssignment: true }), typescript({ target: 'es5' }), commonjs(), @@ -41,6 +42,7 @@ export default [ resolve(), replace({ 'PACKAGE_VERSION_INJECTED_DURING_BUILD': version, + preventAssignment: true }), typescript({ target: "es5" }), commonjs() diff --git a/rollup.dev.config.js b/rollup.dev.config.js index ba0104de..21cc3244 100644 --- a/rollup.dev.config.js +++ b/rollup.dev.config.js @@ -22,7 +22,8 @@ export default { }), resolve(), replace({ - 'PACKAGE_VERSION_INJECTED_DURING_BUILD': version + 'PACKAGE_VERSION_INJECTED_DURING_BUILD': version, + preventAssignment: true }), babel({ exclude: 'node_modules/**' // only transpile our source code diff --git a/tsconfig.json b/tsconfig.json index cd1e61b0..b59eddd7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,14 +2,14 @@ "compilerOptions": { "noImplicitAny": true, "target": "ES2015", - "module": "ES2015", + "module": "ES2022", "moduleResolution": "node", "baseUrl": "src", "esModuleInterop": true, "resolveJsonModule": true, - "allowJs": true + "allowJs": true, }, "include": [ "src" ] -} \ No newline at end of file +}