Skip to content

Commit 7f44491

Browse files
[test-optimization] [SDTEST-303] Fix jest@30 release (#4581)
1 parent 85c5d33 commit 7f44491

File tree

6 files changed

+410
-416
lines changed

6 files changed

+410
-416
lines changed

.github/workflows/test-optimization.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
strategy:
6464
matrix:
6565
version: [oldest, latest]
66-
framework: [cucumber, selenium, mocha]
66+
framework: [cucumber, selenium, jest, mocha]
6767
runs-on: ubuntu-latest
6868
env:
6969
DD_SERVICE: dd-trace-js-integration-tests
@@ -173,21 +173,21 @@ jobs:
173173
- uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
174174

175175
# TODO: fix performance issues and test more Node versions
176-
# plugin-jest:
177-
# runs-on: ubuntu-latest
178-
# env:
179-
# PLUGINS: jest
180-
# steps:
181-
# - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
182-
# - uses: ./.github/actions/testagent/start
183-
# - uses: ./.github/actions/node/active-lts
184-
# - uses: ./.github/actions/install
185-
# - run: yarn test:plugins:ci
186-
# - if: always()
187-
# uses: ./.github/actions/testagent/logs
188-
# with:
189-
# suffix: plugins-${{ github.job }}
190-
# - uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
176+
plugin-jest:
177+
runs-on: ubuntu-latest
178+
env:
179+
PLUGINS: jest
180+
steps:
181+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
182+
- uses: ./.github/actions/testagent/start
183+
- uses: ./.github/actions/node/active-lts
184+
- uses: ./.github/actions/install
185+
- run: yarn test:plugins:ci
186+
- if: always()
187+
uses: ./.github/actions/testagent/logs
188+
with:
189+
suffix: plugins-${{ github.job }}
190+
- uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # v5.4.2
191191

192192
plugin-mocha:
193193
runs-on: ubuntu-latest

integration-tests/ci-visibility/jest-custom-test-sequencer.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

integration-tests/ci-visibility/run-jest.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ const options = {
77
testRegex: process.env.TESTS_TO_RUN ? new RegExp(process.env.TESTS_TO_RUN) : /test\/ci-visibility-test/,
88
coverage: !process.env.DISABLE_CODE_COVERAGE,
99
runInBand: true,
10-
shard: process.env.TEST_SHARD || undefined,
11-
testSequencer: process.env.CUSTOM_TEST_SEQUENCER
10+
shard: process.env.TEST_SHARD || undefined
1211
}
1312

1413
if (process.env.RUN_IN_PARALLEL) {

integration-tests/jest/jest.spec.js

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1427,61 +1427,6 @@ describe('jest CommonJS', () => {
14271427
})
14281428
})
14291429

1430-
it('can skip when using a custom test sequencer', (done) => {
1431-
receiver.setSettings({
1432-
itr_enabled: true,
1433-
tests_skipping: true
1434-
})
1435-
receiver.setSuitesToSkip([{
1436-
type: 'suite',
1437-
attributes: {
1438-
suite: 'ci-visibility/test/ci-visibility-test.js'
1439-
}
1440-
}])
1441-
1442-
const eventsPromise = receiver
1443-
.gatherPayloadsMaxTimeout(({ url }) => url.endsWith('/api/v2/citestcycle'), (payloads) => {
1444-
const events = payloads.flatMap(({ payload }) => payload.events)
1445-
const testEvents = events.filter(event => event.type === 'test')
1446-
// no tests end up running (suite is skipped)
1447-
assert.equal(testEvents.length, 0)
1448-
1449-
const testSession = events.find(event => event.type === 'test_session_end').content
1450-
assert.propertyVal(testSession.meta, TEST_ITR_TESTS_SKIPPED, 'true')
1451-
1452-
const skippedSuite = events.find(event =>
1453-
event.content.resource === 'test_suite.ci-visibility/test/ci-visibility-test.js'
1454-
).content
1455-
assert.propertyVal(skippedSuite.meta, TEST_STATUS, 'skip')
1456-
assert.propertyVal(skippedSuite.meta, TEST_SKIPPED_BY_ITR, 'true')
1457-
})
1458-
childProcess = exec(
1459-
runTestsWithCoverageCommand,
1460-
{
1461-
cwd,
1462-
env: {
1463-
...getCiVisAgentlessConfig(receiver.port),
1464-
CUSTOM_TEST_SEQUENCER: './ci-visibility/jest-custom-test-sequencer.js',
1465-
TEST_SHARD: '2/2'
1466-
},
1467-
stdio: 'inherit'
1468-
}
1469-
)
1470-
childProcess.stdout.on('data', (chunk) => {
1471-
testOutput += chunk.toString()
1472-
})
1473-
childProcess.stderr.on('data', (chunk) => {
1474-
testOutput += chunk.toString()
1475-
})
1476-
1477-
childProcess.on('exit', () => {
1478-
assert.include(testOutput, 'Running shard with a custom sequencer')
1479-
eventsPromise.then(() => {
1480-
done()
1481-
}).catch(done)
1482-
})
1483-
})
1484-
14851430
it('works with multi project setup and test skipping', (done) => {
14861431
receiver.setSettings({
14871432
itr_enabled: true,

0 commit comments

Comments
 (0)