-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(testing): add lerna-smoke-tests #14347
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
49bc60c
chore(testing): add lerna-smoke-tests
JamesHenry 03c7f81
chore(testing): add git metadata in CI
JamesHenry 6dff570
chore(testing): fix serializer so it works in CI
JamesHenry 5dc8af9
chore(repo): switch macos projects to use dedicated target
JamesHenry a90f858
chore(repo): restore exclude for e2e-storybook,e2e-storybook-angular
JamesHenry 4ecf9f6
chore(repo): exclude e2e-detox for now
JamesHenry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,6 +147,11 @@ jobs: | |
NX_E2E_RUN_CYPRESS: 'false' | ||
NX_VERBOSE_LOGGING: 'false' | ||
steps: | ||
- run: | ||
name: Configure git metadata (needed for lerna smoke tests) | ||
command: | | ||
git config --global user.email [email protected] | ||
git config --global user.name "Test Test" | ||
- run: | ||
name: Set dynamic nx run variable | ||
command: | | ||
|
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,11 @@ | ||
/* eslint-disable */ | ||
export default { | ||
transform: { | ||
'^.+\\.[tj]sx?$': 'ts-jest', | ||
}, | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], | ||
maxWorkers: 1, | ||
globals: { 'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' } }, | ||
displayName: 'e2e-lerna-smoke-tests', | ||
preset: '../../jest.preset.js', | ||
}; |
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,11 @@ | ||
{ | ||
"name": "e2e-lerna-smoke-tests", | ||
"$schema": "../../node_modules/nx/schemas/project-schema.json", | ||
"sourceRoot": "e2e/lerna-smoke-tests", | ||
"projectType": "application", | ||
"targets": { | ||
"e2e": {}, | ||
"run-e2e-tests": {} | ||
}, | ||
"implicitDependencies": ["nx", "devkit"] | ||
} |
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,79 @@ | ||
/** | ||
* These minimal smoke tests are here to ensure that we do not break assumptions on the lerna side | ||
* when making updates to nx or @nrwl/devkit. | ||
*/ | ||
|
||
import { | ||
cleanupLernaWorkspace, | ||
newLernaWorkspace, | ||
runLernaCLI, | ||
tmpProjPath, | ||
updateJson, | ||
} from '@nrwl/e2e/utils'; | ||
|
||
expect.addSnapshotSerializer({ | ||
serialize(str: string) { | ||
return ( | ||
str | ||
// Not all package managers print the package.json path in the output | ||
.replace(tmpProjPath(), '') | ||
.replace('/private', '') | ||
.replace('/packages/package-1', '') | ||
// We trim each line to reduce the chances of snapshot flakiness | ||
.split('\n') | ||
.map((r) => r.trim()) | ||
.join('\n') | ||
); | ||
}, | ||
test(val: string) { | ||
return val != null && typeof val === 'string'; | ||
}, | ||
}); | ||
|
||
describe('Lerna Smoke Tests', () => { | ||
beforeAll(() => newLernaWorkspace()); | ||
afterAll(() => cleanupLernaWorkspace()); | ||
|
||
// `lerna repair` builds on top of `nx repair` and runs all of its generators | ||
describe('lerna repair', () => { | ||
// If this snapshot fails it means that nx repair generators are making assumptions which don't hold true for lerna workspaces | ||
it('should complete successfully on a new lerna workspace', async () => { | ||
expect(runLernaCLI(`repair`)).toMatchInlineSnapshot(` | ||
|
||
> Lerna No changes were necessary. This workspace is up to date! | ||
|
||
|
||
`); | ||
}, 1000000); | ||
}); | ||
|
||
// `lerna run` delegates to the nx task runner behind the scenes | ||
describe('lerna run', () => { | ||
it('should complete successfully on a new lerna workspace', async () => { | ||
runLernaCLI('create package-1 -y'); | ||
updateJson('packages/package-1/package.json', (json) => ({ | ||
...json, | ||
scripts: { | ||
...(json.scripts || {}), | ||
'print-name': 'echo test-package-1', | ||
}, | ||
})); | ||
|
||
expect(runLernaCLI(`run print-name`)).toMatchInlineSnapshot(` | ||
|
||
> package-1:print-name | ||
|
||
> [email protected] print-name | ||
> echo test-package-1 | ||
test-package-1 | ||
|
||
|
||
|
||
> Lerna (powered by Nx) Successfully ran target print-name for project package-1 | ||
|
||
|
||
|
||
`); | ||
}, 1000000); | ||
}); | ||
}); |
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,13 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"types": ["node", "jest"] | ||
}, | ||
"include": [], | ||
"files": [], | ||
"references": [ | ||
{ | ||
"path": "./tsconfig.spec.json" | ||
} | ||
] | ||
} |
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,20 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"outDir": "../../dist/out-tsc", | ||
"module": "commonjs", | ||
"types": ["jest", "node"] | ||
}, | ||
"include": [ | ||
"**/*.test.ts", | ||
"**/*.spec.ts", | ||
"**/*.spec.tsx", | ||
"**/*.test.tsx", | ||
"**/*.spec.js", | ||
"**/*.test.js", | ||
"**/*.spec.jsx", | ||
"**/*.test.jsx", | ||
"**/*.d.ts", | ||
"jest.config.ts" | ||
] | ||
} |
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 |
---|---|---|
|
@@ -95,6 +95,9 @@ | |
{ | ||
"env": "SELECTED_CLI" | ||
}, | ||
{ | ||
"env": "SELECTED_PM" | ||
}, | ||
{ | ||
"env": "NX_E2E_CI_CACHE_KEY" | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I discovered this was missing from the cache key when switching package managers locally to test this