Skip to content

Commit 3f9b76e

Browse files
committed
ci(test-optimization): run datadog-plugin-jest unit spec
`packages/datadog-plugin-jest/test/util.spec.js` is matched by `test:plugins`' glob but no workflow set `PLUGINS=jest` for `test:plugins:ci`; the existing `integration-jest` matrix runs `integration-tests/jest/*.spec.js` only, which does not cover the plugin package's own unit tests. The new joint check flagged it as never reached. Add a single `jest:` job invoking the `plugins/test` composite action. `util.spec.js` is a pure unit test on `getFormattedJestTestParameters` and `getJestSuitesToRun`, so no service containers or matrix axes are needed beyond what `plugins/test` already covers (oldest-maintenance and latest Node). Restore the three fixture files (`test-to-run.js`, `test-to-skip.js`, `test-unskippable.js`) under `packages/datadog-plugin-jest/test/fixtures/` that `getJestSuitesToRun` reads via `isMarkedAsUnskippable`. They were deleted alongside the other jest plugin specs when those moved to integration tests, but `util.spec.js` was kept and silently broke because no CI invocation reached it.
1 parent d411315 commit 3f9b76e

5 files changed

Lines changed: 49 additions & 0 deletions

File tree

.github/workflows/test-optimization.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,19 @@ jobs:
206206
flags: test-optimization-jest-${{ matrix.version }}-${{ matrix.jest-version }}
207207
dd_api_key: ${{ steps.dd-sts.outputs.api_key }}
208208

209+
# Unit tests for `packages/datadog-plugin-jest`. The `integration-jest` matrix above only runs
210+
# `integration-tests/jest/*.spec.js`, so this is the only CI invocation whose glob expands to
211+
# cover `packages/datadog-plugin-jest/test/util.spec.js`.
212+
jest:
213+
runs-on: ubuntu-latest
214+
permissions:
215+
id-token: write
216+
env:
217+
PLUGINS: jest
218+
steps:
219+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
220+
- uses: ./.github/actions/plugins/test
221+
209222
integration-cucumber:
210223
strategy:
211224
fail-fast: false

eslint.config.mjs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,6 +802,15 @@ export default [
802802
'mocha/no-pending-tests': 'off',
803803
},
804804
},
805+
{
806+
// jest-docblock's `@datadog {"unskippable": true}` tag reads as a malformed
807+
// JSDoc type to `jsdoc/valid-types`. The shape is required by the plugin.
808+
name: 'dd-trace/datadog-plugin-jest/fixtures',
809+
files: ['packages/datadog-plugin-jest/test/fixtures/**/*.js'],
810+
rules: {
811+
'jsdoc/valid-types': 'off',
812+
},
813+
},
805814
{
806815
// CI-visibility retry fixtures intentionally call `this.retries(N)` to
807816
// exercise the dd-trace test-optimization retry code paths. The fixtures
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict'
2+
3+
// Fixture for util.spec.js. `getJestSuitesToRun` reads this file to scan for
4+
// a `@datadog` docblock; the body of the suite is never executed.
5+
6+
describe('test-to-run', () => {
7+
it('is a placeholder fixture', () => {})
8+
})
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
'use strict'
2+
3+
// Fixture for util.spec.js. `getJestSuitesToRun` reads this file to scan for
4+
// a `@datadog` docblock; the body of the suite is never executed.
5+
6+
describe('test-to-skip', () => {
7+
it('is a placeholder fixture', () => {})
8+
})
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* @datadog {"unskippable": true}
3+
*/
4+
'use strict'
5+
6+
// Fixture for util.spec.js. `getJestSuitesToRun` reads this file to scan for
7+
// the `@datadog` docblock above; the body of the suite is never executed.
8+
9+
describe('test-unskippable', () => {
10+
it('is a placeholder fixture', () => {})
11+
})

0 commit comments

Comments
 (0)