Skip to content

Commit

Permalink
fix cf worker esbuild test
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Mar 17, 2022
1 parent 8c2eec2 commit 14f4fed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/cloudflare-workers-esbuild/.test-dev.spec.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { testRun } from '../cloudflare-workers/.testRun'
testRun('npm run dev', { hasStarWarsPage: true })
testRun('npm run dev', { hasStarWarsPage: true, isCustomBuild: true })
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { testRun } from '../cloudflare-workers/.testRun'
testRun('npm run preview:miniflare', { hasStarWarsPage: true })
testRun('npm run preview:miniflare', { hasStarWarsPage: true, isCustomBuild: true })
2 changes: 1 addition & 1 deletion examples/cloudflare-workers-esbuild/.test-wrangler.spec.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
import { testRun } from '../cloudflare-workers/.testRun'
testRun('npm run preview:wrangler', { hasStarWarsPage: true })
testRun('npm run preview:wrangler', { hasStarWarsPage: true, isCustomBuild: true })
12 changes: 8 additions & 4 deletions examples/cloudflare-workers/.testRun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,24 @@ export { testRun }

function testRun(
cmd: 'npm run dev' | 'npm run preview:miniflare' | 'npm run preview:wrangler',
{ hasStarWarsPage }: { hasStarWarsPage: boolean },
{ hasStarWarsPage, isCustomBuild }: { hasStarWarsPage?: true; isCustomBuild?: true },
) {
const isMiniflare = cmd === 'npm run preview:miniflare'
const isWrangler = cmd === 'npm run preview:wrangler'
const isWorker = isMiniflare || isWrangler

if ((isWindows() || isNode12()) && isWorker) {
test('SKIPED: miniflare and wrangler', () => {})
const msg = 'SKIPED: miniflare and wrangler'
console.log(msg)
test(msg, () => {})
return
}

if (isWrangler) {
if (!isGithubAction() || process.env['GIT_BRANCH'] !== 'master') {
test('SKIPED: wrangler test is not run locally nor in Pull Requests', () => {})
const msg = 'SKIPED: wrangler test is not run locally nor in Pull Requests'
console.log(msg)
test(msg, () => {})
return
}
test('API keys', () => {
Expand All @@ -31,7 +35,7 @@ function testRun(
{
const additionalTimeout = !isWorker ? 0 : (isGithubAction() ? 2 : 1) * 120 * 1000
const serverIsReadyMessage = (() => {
if (isMiniflare) {
if (isMiniflare || isCustomBuild) {
return 'Listening on'
}
if (isWrangler) {
Expand Down

0 comments on commit 14f4fed

Please sign in to comment.