From 92585f674385c28dfb25466538ed02fe43f418a8 Mon Sep 17 00:00:00 2001 From: Giora Guttsait Date: Wed, 16 Mar 2022 12:14:00 +0200 Subject: [PATCH] chore(js): update tests --- e2e/js/src/js.test.ts | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/e2e/js/src/js.test.ts b/e2e/js/src/js.test.ts index 0e6911dcf0a581..4d5106b9565115 100644 --- a/e2e/js/src/js.test.ts +++ b/e2e/js/src/js.test.ts @@ -34,7 +34,7 @@ describe('js e2e', () => { }); }, 120000); - fit('should create libs with js executors (--compiler=tsc)', async () => { + it('should create libs with js executors (--compiler=tsc)', async () => { const lib = uniq('lib'); runCLI(`generate @nrwl/js:lib ${lib} --buildable --compiler=tsc`); const libPackageJson = readJson(`libs/${lib}/package.json`); @@ -127,21 +127,31 @@ describe('js e2e', () => { expect(output).toContain('1 task(s) it depends on'); expect(output).toContain('Done compiling TypeScript files'); - const libWithImportHelpers = uniq('lib-with-import-helpers'); - runCLI( - `generate @nrwl/js:lib ${libWithImportHelpers} --buildable --compiler=tsc` + updateJson(`libs/${lib}/tsconfig.json`, (json) => { + json.compilerOptions = { ...json.compilerOptions, importHelpers: true }; + return json; + }); + + runCLI(`build ${lib}`); + + const rootPackageJson = readJson(`package.json`); + + expect(readJson(`dist/libs/${lib}/package.json`)).toHaveProperty( + 'peerDependencies.tslib', + rootPackageJson.dependencies.tslib ?? + rootPackageJson.devDependencies.tslib ); - updateJson(`libs/${libWithImportHelpers}/tsconfig.json`, (json) => { - json.compilerOptions = { ...json.compilerOptions, importHelpers: true }; + updateJson(`libs/${lib}/tsconfig.json`, (json) => { + json.compilerOptions = { ...json.compilerOptions, importHelpers: false }; return json; }); - runCLI(`build ${libWithImportHelpers}`); + runCLI(`build ${lib}`); - expect( - readJson(`dist/libs/${libWithImportHelpers}/package.json`) - ).toHaveProperty('peerDependencies.tslib'); + expect(readJson(`dist/libs/${lib}/package.json`)).not.toHaveProperty( + 'peerDependencies.tslib' + ); }, 120000); it('should create libs with js executors (--compiler=swc)', async () => {