From 328b3c462a8bc6d48471264339e97b9ec1edb900 Mon Sep 17 00:00:00 2001 From: Russell Bicknell Date: Tue, 17 Apr 2018 12:35:47 -0700 Subject: [PATCH] `polymer test`: Pass `moduleResolution: x` option from config to WCT as `--module-resolution=${x}`. --- packages/cli/src/commands/test.ts | 4 ++++ packages/cli/src/test/integration/integration_test.ts | 8 ++------ packages/cli/src/test/unit/commands/test_test.ts | 10 ++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/cli/src/commands/test.ts b/packages/cli/src/commands/test.ts index 505d39408..a200448fd 100644 --- a/packages/cli/src/commands/test.ts +++ b/packages/cli/src/commands/test.ts @@ -149,6 +149,10 @@ export class TestCommand implements Command { wctArgs.push('--npm'); } + if (config.moduleResolution) { + wctArgs.push(`--module-resolution=${config.moduleResolution}`); + } + if (config.componentDir) { wctArgs.push(`--component-dir='${config.componentDir}'`); } diff --git a/packages/cli/src/test/integration/integration_test.ts b/packages/cli/src/test/integration/integration_test.ts index 26905f5af..a572f5996 100644 --- a/packages/cli/src/test/integration/integration_test.ts +++ b/packages/cli/src/test/integration/integration_test.ts @@ -41,9 +41,7 @@ suite('integration tests', function() { .toPromise(); await runCommand(binPath, ['install'], {cwd: dir}); await runCommand(binPath, ['lint'], {cwd: dir}); - // TODO(#113): Remove the `--module-resolution=node` argument once - // `polymer test` passes them in correctly - await runCommand(binPath, ['test', '--module-resolution=node'], {cwd: dir}); + await runCommand(binPath, ['test'], {cwd: dir}); }); skipOnWindows('test the Polymer 3.x application template', async () => { @@ -53,9 +51,7 @@ suite('integration tests', function() { .toPromise(); await runCommand(binPath, ['install'], {cwd: dir}); await runCommand(binPath, ['lint'], {cwd: dir}); - // TODO(#113): Remove the `--module-resolution=node` argument once - // `polymer test` passes them in correctly - await runCommand(binPath, ['test', '--module-resolution=node'], {cwd: dir}); + await runCommand(binPath, ['test'], {cwd: dir}); await runCommand(binPath, ['build'], {cwd: dir}); }); diff --git a/packages/cli/src/test/unit/commands/test_test.ts b/packages/cli/src/test/unit/commands/test_test.ts index 1ae532c91..079bf8e00 100644 --- a/packages/cli/src/test/unit/commands/test_test.ts +++ b/packages/cli/src/test/unit/commands/test_test.ts @@ -66,4 +66,14 @@ suite('test', () => { assert.includeMembers(wctArgs, [`--component-dir='path/to/deps/'`]); }); + test('--module-resolution flag is passed to WCT', async () => { + const wctCliRunStub = + sandbox.stub(wct.cli, 'run').returns(Promise.resolve()); + const cli = new PolymerCli(['test', '--module-resolution=node']); + await cli.run(); + + const wctArgs = wctCliRunStub.args[0][1]; + assert.includeMembers(wctArgs, [`--module-resolution=node`]); + }); + });