Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
TheUnderScorer committed Dec 28, 2023
1 parent 9eddd78 commit 917970c
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 27 deletions.
1 change: 1 addition & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ const { getJestProjects } = require('@nx/jest');

export default {
projects: getJestProjects(),
testTimeout: 200_000,
};
128 changes: 112 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
"@typescript-eslint/eslint-plugin": "6.15.0",
"@typescript-eslint/parser": "6.15.0",
"@zerollup/ts-transform-paths": "^1.7.18",
"ajv": "^8.12.0",
"conventional-changelog-conventionalcommits": "^5.0.0",
"dotenv": "^16.3.1",
"eslint": "8.48.0",
Expand Down
1 change: 0 additions & 1 deletion packages/nx-semantic-release/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,4 @@ export default {
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/packages/nx-semantic-release',
setupFiles: [path.resolve(__dirname, './src/tests/setup.ts')],
testTimeout: 200_000,
};
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('resolveOptions', () => {
let mockContext: GetProjectContext;

beforeAll(async () => {
await setupTestRepo();
await setupTestRepo(false);

const projPath = tmpProjPath();

Expand Down
17 changes: 8 additions & 9 deletions packages/nx-semantic-release/src/tests/setup-test-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,13 @@ function createPackageJsonForProjects() {

async function bootstrapTestProjectsAndLibs() {
testApps.forEach((project) => {
runNxCommand(
`generate @nx/web:application ${project} --directory apps/${project} --e2e-test-runner=none`
);
const command = `generate @nx/web:application apps/${project} --e2e-test-runner=none`;

runNxCommand(command);
});

testLibs.forEach((lib) => {
runNxCommand(`generate @nx/js:library ${lib} --directory libs/${lib}`);
runNxCommand(`generate @nx/js:library libs/${lib}`);
});

createPackageJsonForProjects();
Expand Down Expand Up @@ -183,9 +183,10 @@ async function bootstrapTestProjectsAndLibs() {
function updateWorkspaceNxConfig() {
const nxJson = readJson<NxJsonConfiguration>('nx.json');

nxJson.implicitDependencies = {
...nxJson.implicitDependencies,
'test-only.txt': '*',
nxJson.namedInputs = {
...nxJson.namedInputs,
sharedGlobals: ['{workspaceRoot}/test-only.txt'],
default: ['sharedGlobals'],
};

nxJson.targetDefaults = {
Expand Down Expand Up @@ -288,8 +289,6 @@ export async function setupTestRepo(

await bootstrapTestProjectsAndLibs();

await runCommandsInTestProj(['npm install -D ajv']);

if (withGit) {
await runCommandsInTestProj([
'git add apps/app-a',
Expand Down

0 comments on commit 917970c

Please sign in to comment.