-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE `js` files from `node_modules` are now compiled with `esbuild` to improve performance
- Loading branch information
Showing
23 changed files
with
471 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { json as runWithJson } from '../run-jest'; | ||
import { jsonNoCache as runWithJsonNoCache } from '../run-jest'; | ||
|
||
const DIR = 'jest-globals'; | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: false`, () => { | ||
const { json } = runWithJson(DIR); | ||
const { json } = runWithJsonNoCache(DIR); | ||
|
||
expect(json.success).toBe(true); | ||
}); | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: true`, () => { | ||
const { json } = runWithJson(DIR, ['-c=jest-isolated.config.js']); | ||
const { json } = runWithJsonNoCache(DIR, ['-c=jest-isolated.config.js']); | ||
|
||
expect(json.success).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { json as runWithJson } from '../run-jest'; | ||
import { jsonNoCache as runWithJsonNoCache } from '../run-jest'; | ||
|
||
const DIR = 'ng-deep-import'; | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: false`, () => { | ||
const { json } = runWithJson(DIR); | ||
const { json } = runWithJsonNoCache(DIR); | ||
|
||
expect(json.success).toBe(true); | ||
}); | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: true`, () => { | ||
const { json } = runWithJson(DIR, ['-c=jest-isolated.config.js']); | ||
const { json } = runWithJsonNoCache(DIR, ['-c=jest-isolated.config.js']); | ||
|
||
expect(json.success).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { json as runWithJson } from '../run-jest'; | ||
import { jsonNoCache as runWithJsonNoCache } from '../run-jest'; | ||
|
||
const DIR = 'ng-lib-import'; | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: false`, () => { | ||
const { json } = runWithJson(DIR); | ||
const { json } = runWithJsonNoCache(DIR); | ||
|
||
expect(json.success).toBe(true); | ||
}); | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: true`, () => { | ||
const { json } = runWithJson(DIR, ['-c=jest-isolated.config.js']); | ||
const { json } = runWithJsonNoCache(DIR, ['-c=jest-isolated.config.js']); | ||
|
||
expect(json.success).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { json as runWithJson } from '../run-jest'; | ||
import { jsonNoCache as runWithJsonNoCache } from '../run-jest'; | ||
|
||
const DIR = 'path-mapping'; | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: false`, () => { | ||
const { json } = runWithJson(DIR); | ||
const { json } = runWithJsonNoCache(DIR); | ||
|
||
expect(json.success).toBe(true); | ||
}); | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: true`, () => { | ||
const { json } = runWithJson(DIR, ['-c=jest-isolated.config.js']); | ||
const { json } = runWithJsonNoCache(DIR, ['-c=jest-isolated.config.js']); | ||
|
||
expect(json.success).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
import { jsonNoCache as runWithJsonNoCache } from '../run-jest'; | ||
|
||
const TEST_DIR_NAME = 'process-js-packages'; | ||
const TEST_DIR_PATH = path.join(__dirname, '..', TEST_DIR_NAME); | ||
const LOG_FILE_NAME = 'ng-jest.log'; | ||
const LOG_FILE_PATH = path.join(TEST_DIR_PATH, LOG_FILE_NAME); | ||
|
||
test(`successfully runs the tests inside ${TEST_DIR_NAME}`, () => { | ||
process.env.NG_JEST_LOG = LOG_FILE_NAME; | ||
|
||
const { json } = runWithJsonNoCache(TEST_DIR_NAME); | ||
|
||
expect(json.success).toBe(true); | ||
expect(fs.existsSync(LOG_FILE_PATH)).toBe(true); | ||
|
||
const logFileContent = fs.readFileSync(LOG_FILE_PATH, 'utf-8'); | ||
const logFileContentAsJson = JSON.parse(logFileContent); | ||
|
||
expect(/node_modules\/(.*.m?js$)/.test(logFileContentAsJson.context.filePath.replace(/\\/g, '/'))).toBe(true); | ||
expect(logFileContentAsJson.message).toBe('process with esbuild'); | ||
|
||
delete process.env.NG_JEST_LOG; | ||
fs.unlinkSync(LOG_FILE_PATH); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { json as runWithJson } from '../run-jest'; | ||
import { jsonNoCache as runWithJsonNoCache } from '../run-jest'; | ||
|
||
const DIR = 'snapshot-serializers'; | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: false`, () => { | ||
const { json } = runWithJson(DIR); | ||
const { json } = runWithJsonNoCache(DIR); | ||
|
||
expect(json.success).toBe(true); | ||
}); | ||
|
||
test(`successfully runs the tests inside ${DIR} with isolatedModules: true`, () => { | ||
const { json } = runWithJson(DIR, ['-c=jest-isolated.config.js']); | ||
const { json } = runWithJsonNoCache(DIR, ['-c=jest-isolated.config.js']); | ||
|
||
expect(json.success).toBe(true); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { foo } from 'my-lib'; | ||
|
||
test('should pass', () => { | ||
expect(foo).toBe(1); | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "process-js-packages", | ||
"jest": { | ||
"moduleFileExtensions": ["ts", "html", "js", "json", "mjs"], | ||
"globals": { | ||
"ts-jest": { | ||
"isolatedModules": true | ||
} | ||
}, | ||
"transform": { | ||
"^.+\\.(ts|js|mjs|html)$": "<rootDir>/../../build/index.js" | ||
}, | ||
"transformIgnorePatterns": ["node_modules/(?!my-lib)"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.