Skip to content

Commit

Permalink
Move component tests to tests/
Browse files Browse the repository at this point in the history
  • Loading branch information
MetRonnie committed May 20, 2024
1 parent 8221fc5 commit 8a7e710
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
selenium-debug.log*
vite.config.*.timestamp*

# Coverage
.nyc_output/
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ There are three groups of tests:
* Unit tests
* Simple unit tests for individual functions and classes.
* **Framework:** [Vitest](https://vitest.dev/)
* **Assertions:** [Chai](https://www.chaijs.com/)/[Jest](https://jestjs.io/docs/expect)
* **Assertions:** [Chai](https://www.chaijs.com/)/[Vitest](https://vitest.dev/api/expect.html)
* **Path:** `tests/unit`
* **Command:** `yarn run test:unit` (watches by default, only re-runs changed file)
* (To prevent watching, use `yarn vitest run`)
* Component tests
* In-browser tests which mount a single Vue component standalone.
* **Framework:** [Cypress](https://docs.cypress.io/guides/overview/why-cypress)
* **Assertions:** Chai
* **Path:** `cypress/component`
* **Path:** `tests/component`
* **Command:** `yarn run test:component`
* (For "headless" mode use `yarn cypress run --component --config video=false`)
* End to end tests
Expand Down
12 changes: 4 additions & 8 deletions cypress.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,7 @@ module.exports = defineConfig({
mode: 'development',
})
)

return Object.assign({}, config, {
fixturesFolder: 'tests/e2e/fixtures',
specPattern: 'tests/e2e/specs',
screenshotsFolder: 'tests/e2e/screenshots',
videosFolder: 'tests/e2e/videos',
supportFile: 'tests/e2e/support/index.js'
})
return config
},
specPattern: 'tests/e2e/specs/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'tests/e2e/support/index.js'
Expand All @@ -56,6 +49,9 @@ module.exports = defineConfig({
require('@cypress/code-coverage/task')(on, config)
return config
},
specPattern: 'tests/component/**/*.cy.{js,jsx,ts,tsx}',
supportFile: 'tests/component/support/index.js',
indexHtmlFile: 'tests/component/support/component-index.html'
},

env: {
Expand Down
25 changes: 25 additions & 0 deletions tests/component/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

module.exports = {
plugins: [
'cypress'
],
env: {
'cypress/globals': true
},
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 1 addition & 4 deletions tests/e2e/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/*
* Copyright (C) NIWA & British Crown (Met Office) & Contributors.
*
* This program is free software: you can redistribute it and/or modify
Expand All @@ -22,7 +22,4 @@ module.exports = {
env: {
'cypress/globals': true
},
rules: {
strict: 'off'
}
}

0 comments on commit 8a7e710

Please sign in to comment.