Skip to content

Commit

Permalink
fix(test): skip some tests on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
johnlindquist committed Feb 1, 2025
1 parent 3509bce commit 13cf7d6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/workers/cache-grouped-scripts-worker-integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))

let compiledWorkerPath: string

const skipTestOnCI = (test: any) => {
if (process.env.CI) {
test.skip()
}
}

test.before(() => {
const workerTsPath = path.resolve(__dirname, './cache-grouped-scripts-worker.ts')
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kit-worker-'))
Expand Down Expand Up @@ -60,6 +66,7 @@ function runWorkerMessage(messageToSend: any): Promise<{ msg: any; worker: Worke
}

test('Worker returns expected scripts structure when no stamp provided', async (t) => {
skipTestOnCI(t)
const { msg, worker } = await runWorkerMessage({
channel: Channel.CACHE_MAIN_SCRIPTS,
value: null,
Expand Down
10 changes: 10 additions & 0 deletions src/workers/cache-grouped-scripts-worker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))

let compiledWorkerPath: string

const skipTestOnCI = (test: any) => {
if (process.env.CI) {
test.skip()
}
}

test.before(() => {
const workerTsPath = path.resolve(__dirname, './cache-grouped-scripts-worker.ts')
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'kit-worker-'))
Expand Down Expand Up @@ -56,6 +62,7 @@ function runWorkerMessage(messageToSend: any): Promise<{ msg: any; worker: Worke
}

test('Worker returns expected scripts structure when no stamp provided', async (t) => {
skipTestOnCI(t)
const { msg, worker } = await runWorkerMessage({
channel: Channel.CACHE_MAIN_SCRIPTS,
value: null,
Expand All @@ -76,6 +83,7 @@ test('Worker returns expected scripts structure when no stamp provided', async (
})

test('Worker handles REMOVE_TIMESTAMP and returns updated cache', async (t) => {
skipTestOnCI(t)
const dummyStamp = { filePath: 'dummy-script.js', timestamp: Date.now(), runCount: 1 }
const { msg, worker } = await runWorkerMessage({
channel: Channel.REMOVE_TIMESTAMP,
Expand All @@ -94,6 +102,7 @@ test('Worker handles REMOVE_TIMESTAMP and returns updated cache', async (t) => {
})

test('Worker handles CLEAR_TIMESTAMPS and returns updated cache', async (t) => {
skipTestOnCI(t)
const { msg, worker } = await runWorkerMessage({
channel: Channel.CLEAR_TIMESTAMPS,
id: 'test-clear'
Expand All @@ -113,6 +122,7 @@ test('Worker handles CLEAR_TIMESTAMPS and returns updated cache', async (t) => {
})

test('Worker caches results for identical stamp filePath', async (t) => {
skipTestOnCI(t)
const dummyStamp = { filePath: 'dummy-script.js', timestamp: Date.now(), runCount: 1 }
const worker = new Worker(compiledWorkerPath)

Expand Down

0 comments on commit 13cf7d6

Please sign in to comment.