Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(crwa): switch to vitest #9855

Merged
merged 3 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ jobs:
git config --global user.name "Your Name"

- name: e2e test
run: yarn test e2e
run: yarn test:e2e
working-directory: ./packages/create-redwood-app
env:
PROJECT_PATH: ${{ env.PROJECT_PATH }}
Expand Down
5 changes: 0 additions & 5 deletions packages/create-redwood-app/jest.config.js

This file was deleted.

5 changes: 3 additions & 2 deletions packages/create-redwood-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"build:watch": "nodemon --watch src --ignore dist,template --exec \"yarn build\"",
"prepublishOnly": "NODE_ENV=production yarn build",
"set-up-test-project": "node ./scripts/setUpTestProject.js",
"test": "node --experimental-vm-modules $(yarn bin jest) templates",
"test:e2e": "node --experimental-vm-modules $(yarn bin jest) e2e",
"test": "vitest run templates",
"test:e2e": "vitest --pool=forks run e2e",
"ts-to-js": "yarn node ./scripts/tsToJS.js"
},
"devDependencies": {
Expand All @@ -47,6 +47,7 @@
"terminal-link": "2.1.1",
"untildify": "4.0.0",
"uuid": "9.0.1",
"vitest": "1.2.1",
"yargs": "17.7.2"
},
"gitHead": "3905ed045508b861b495f8d5630d76c7a157d8f1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* eslint-env node */

import { describe, test, expect, it } from 'vitest'
import { cd, fs, $ } from 'zx'

if (!process.env.PROJECT_PATH) {
throw new Error('PROJECT_PATH environment variable is not set')
}
const projectPath = await fs.realpath(process.env.PROJECT_PATH)

cd(projectPath)
Expand Down Expand Up @@ -83,7 +87,7 @@ describe('create-redwood-app', () => {
await fs.rm('./redwood-app', { recursive: true, force: true })
})

it.failing('fails on unknown options', async () => {
it.fails('fails on unknown options', async () => {
try {
await $`yarn create-redwood-app --unknown-options`.timeout(2500)
// Fail the test if the function didn't throw.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import path from 'node:path'
import { fileURLToPath } from 'node:url'

import klawSync from 'klaw-sync'
import { describe, it, expect } from 'vitest'

const TS_TEMPLATE_DIR = fileURLToPath(
new URL('../templates/ts', import.meta.url)
Expand Down Expand Up @@ -192,7 +193,7 @@ describe('JS template', () => {
* @returns string[]
*/
function getDirectoryStructure(dir) {
let fileStructure = klawSync(dir)
const fileStructure = klawSync(dir)

return fileStructure
.filter(
Expand Down
7 changes: 7 additions & 0 deletions packages/create-redwood-app/vitest.config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig, configDefaults } from 'vitest/config'

export default defineConfig({
test: {
exclude: [...configDefaults.exclude, 'templates/**'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty nice that we can just extend from the defaults whereas we had to list all the defaults like node_modules before if we were extending from them

},
})
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15992,6 +15992,7 @@ __metadata:
terminal-link: "npm:2.1.1"
untildify: "npm:4.0.0"
uuid: "npm:9.0.1"
vitest: "npm:1.2.1"
yargs: "npm:17.7.2"
bin:
create-redwood-app: ./dist/create-redwood-app.js
Expand Down
Loading