diff --git a/test/cli/test.js b/test/cli/test.js index 4dabd937..14b6dc4d 100644 --- a/test/cli/test.js +++ b/test/cli/test.js @@ -224,7 +224,13 @@ test('`fusion test` coverage', async t => { // Look for something like coverage t.ok(response.stdout.includes('Uncovered Line #s')); + // This file is outside of src and should not be included in coverage t.ok(!response.stdout.includes('should-not-count-for-coverage.js')); + + // These files instruments the istanbul ignore annotation and should not be included in coverage + t.ok(!response.stdout.includes('istanbul-ignore-coverage.js')); + t.ok(!response.stdout.includes('istanbul-ignore-coverage.flow.js')); + t.end(); }); diff --git a/test/fixtures/test-jest-app/src/istanbul-ignore-coverage.flow.js b/test/fixtures/test-jest-app/src/istanbul-ignore-coverage.flow.js new file mode 100644 index 00000000..aacb0e89 --- /dev/null +++ b/test/fixtures/test-jest-app/src/istanbul-ignore-coverage.flow.js @@ -0,0 +1,8 @@ +/* istanbul ignore file */ +// @generated +// @flow +// This file should not be present in coverage due to the istanbul ignore file annotation. +// The `import *` syntax is required for this test case. +import * as FusionCore from 'fusion-core'; + +export type Something = FusionCore.Context; diff --git a/test/fixtures/test-jest-app/src/istanbul-ignore-coverage.js b/test/fixtures/test-jest-app/src/istanbul-ignore-coverage.js new file mode 100644 index 00000000..8760ab04 --- /dev/null +++ b/test/fixtures/test-jest-app/src/istanbul-ignore-coverage.js @@ -0,0 +1,4 @@ +/* istanbul ignore file */ +// @flow + +export default function() {} diff --git a/test/fixtures/test-jest-app/src/main.js b/test/fixtures/test-jest-app/src/main.js index f94cdac9..cfe7dde6 100644 --- a/test/fixtures/test-jest-app/src/main.js +++ b/test/fixtures/test-jest-app/src/main.js @@ -1,5 +1,9 @@ +// @flow import {foo} from './foo.js'; +import noop from './istanbul-ignore-coverage.js'; +import type {Something} from './istanbul-ignore-coverage.flow.js'; -export default function () { +export default function() { + noop(); return foo(); }