Skip to content

Commit

Permalink
fix(repo): fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
meeroslav committed Apr 17, 2023
1 parent e880f11 commit 3d85ac0
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/generated/packages/jest/documents/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ In order to use Jest's global setup/teardown functions that reference nx librari
Nx provides a helper function that you can import within your setup/teardown file.
```typescript {% fileName="global-setup.ts" %}
import { registerTsProject } from '@nrwl/js';
import { registerTsProject } from '@nrwl/js/src/internal';
const cleanupRegisteredPaths = registerTsProject('.', 'tsconfig.base.json');
import { yourFancyFunction } from '@some-org/my-util-library';
Expand Down
2 changes: 1 addition & 1 deletion docs/shared/packages/jest/jest-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ In order to use Jest's global setup/teardown functions that reference nx librari
Nx provides a helper function that you can import within your setup/teardown file.
```typescript {% fileName="global-setup.ts" %}
import { registerTsProject } from '@nrwl/js';
import { registerTsProject } from '@nrwl/js/src/internal';
const cleanupRegisteredPaths = registerTsProject('.', 'tsconfig.base.json');
import { yourFancyFunction } from '@some-org/my-util-library';
Expand Down
29 changes: 14 additions & 15 deletions e2e/jest/src/jest.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('Jest', () => {
updateFile(
`libs/${mylib}/setup.ts`,
stripIndents`
const { registerTsProject } = require('@nrwl/js');
const { registerTsProject } = require('nx/src/plugins/js/utils/register');
const cleanup = registerTsProject('.', 'tsconfig.base.json');
import {setup} from '@global-fun/globals';
Expand All @@ -61,7 +61,7 @@ describe('Jest', () => {
updateFile(
`libs/${mylib}/teardown.ts`,
stripIndents`
import { registerTsProject } from '@nrwl/js';
import { registerTsProject } from 'nx/src/plugins/js/utils/register';
const cleanup = registerTsProject('.', 'tsconfig.base.json');
import {teardown} from '@global-fun/globals';
Expand All @@ -73,19 +73,18 @@ describe('Jest', () => {
updateFile(
`libs/${mylib}/jest.config.ts`,
stripIndents`
module.exports = {
testMatch: ['**/+(*.)+(spec|test).+(ts|js)?(x)'],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest'
},
resolver: '@nrwl/jest/plugins/resolver',
moduleFileExtensions: ['ts', 'js', 'html'],
coverageReporters: ['html'],
passWithNoTests: true,
globals: { testGlobal: ${testGlobal} },
globalSetup: '<rootDir>/setup.ts',
globalTeardown: '<rootDir>/teardown.ts'
};`
export default {
displayName: "${mylib}",
preset: "../../jest.preset.js",
transform: {
"^.+\\.[tj]s$": ["ts-jest", { tsconfig: "<rootDir>/tsconfig.spec.json" }],
},
moduleFileExtensions: ["ts", "js", "html"],
coverageDirectory: "../../coverage/libs/${mylib}",
globals: { testGlobal: ${testGlobal} },
globalSetup: '<rootDir>/setup.ts',
globalTeardown: '<rootDir>/teardown.ts'
};`
);

const appResult = await runCLIAsync(`test ${mylib} --no-watch`);
Expand Down
2 changes: 1 addition & 1 deletion e2e/node/src/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
} from '@nrwl/e2e/utils';
import { exec, execSync } from 'child_process';
import * as http from 'http';
import { getLockFileName } from '@nrwl/js';
import { getLockFileName } from '@nx/js';
import { satisfies } from 'semver';

function getData(port, path = '/api'): Promise<any> {
Expand Down

0 comments on commit 3d85ac0

Please sign in to comment.