Skip to content

Commit

Permalink
chore(repo): add jest setup back for nx
Browse files Browse the repository at this point in the history
  • Loading branch information
AgentEnder committed Mar 17, 2022
1 parent 6c064e6 commit 748ddb1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions packages/nx/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module.exports = {
name: 'cli',
preset: '../../jest.config.js',
preset: '../../jest.preset.js',
transform: {
'^.+\\.[tj]sx?$': 'ts-jest',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'],
globals: { 'ts-jest': { tsconfig: '<rootDir>/tsconfig.spec.json' } },
displayName: 'nx',
testEnvironment: 'node',
};
8 changes: 8 additions & 0 deletions packages/nx/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@
]
},
"outputs": ["{options.outputFile}"]
},
"test": {
"executor": "@nrwl/jest:jest",
"options": {
"jestConfig": "packages/nx/jest.config.js",
"passWithNoTests": true
},
"outputs": ["coverage/packages/nx"]
}
}
}
1 change: 0 additions & 1 deletion packages/nx/src/commands/migrate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ describe('Migration', () => {
migrations: [],
packageJson: {
'@nrwl/workspace': { version: '2.0.0', addToPackageJson: false },
'@nrwl/cli': { version: '2.0.0', addToPackageJson: false },
'@nrwl/angular': { version: '2.0.0', addToPackageJson: false },
'@nrwl/cypress': { version: '2.0.0', addToPackageJson: false },
'@nrwl/devkit': { addToPackageJson: false, version: '2.0.0' },
Expand Down
4 changes: 2 additions & 2 deletions packages/nx/src/shared/__snapshots__/logger.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Tao Logger should color the NX prefix 1`] = `
exports[`Logger should color the NX prefix 1`] = `
"
>  NX  some Nx message!
"
`;

exports[`Tao Logger should log the full stack trace when an object is being passed 1`] = `
exports[`Logger should log the full stack trace when an object is being passed 1`] = `
"TypeError: Cannot read property 'target' of undefined
 at /someuser/node_modules/@storybook/angular/dist/ts3.9/server/angular-devkit-build-webpack.js:145:49
 at step (/someuser/node_modules/@storybook/angular/dist/ts3.9/server/angular-devkit-build-webpack.js:69:23)
Expand Down
4 changes: 3 additions & 1 deletion packages/nx/src/shared/workspace.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const libConfig = (name) => ({
const packageLibConfig = (root) => ({
root,
sourceRoot: root,
projectType: 'library',
});

describe('Workspaces', () => {
Expand Down Expand Up @@ -102,7 +103,7 @@ describe('Workspaces', () => {
expect(libResults).toEqual('directory-my-lib');
});

it('should custom directories from beginning', () => {
it('should trim custom directories from beginning', () => {
const nxJson: NxJsonConfiguration = {
npmScope: '',
workspaceLayout: {
Expand Down Expand Up @@ -161,6 +162,7 @@ describe('Workspaces', () => {
expect(resolved.projects['my-package']).toEqual({
root: 'packages/my-package',
sourceRoot: 'packages/my-package',
projectType: 'library',
});
});
});
Expand Down
1 change: 1 addition & 0 deletions packages/nx/src/shared/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ function buildProjectConfigurationFromPackageJson(
sourceRoot: directory,
name,
projectType:
nxJson.workspaceLayout?.appsDir != nxJson.workspaceLayout?.libsDir &&
nxJson.workspaceLayout?.appsDir &&
directory.startsWith(nxJson.workspaceLayout.appsDir)
? 'application'
Expand Down

0 comments on commit 748ddb1

Please sign in to comment.