Skip to content

Commit

Permalink
test(grep): add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanpowell88 committed Dec 9, 2022
1 parent 83f4881 commit 71ee31b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
5 changes: 1 addition & 4 deletions npm/grep/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
"description": "Filter tests using substring",
"main": "src/support.js",
"scripts": {
"test:e2e": "mocha -r @packages/ts/register --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json e2e.spec.js --timeout 50000",
"test": "node ../../scripts/cypress.js run --config specPattern='**/unit.js'",
"cy:run": "node ./scripts.js",
"cy:open": "node ../../scripts/cypress.js open --e2e -b electron --config specPattern='**/unit.js'"
"test": "mocha -r @packages/ts/register --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json test.spec.js --timeout 50000"
},
"dependencies": {
"debug": "^4.3.2",
Expand Down
8 changes: 6 additions & 2 deletions npm/grep/e2e.spec.js → npm/grep/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@ const runCommandInProject = async (command, projectPath, _args) => {

const cypressGrepPackagePath = path.join(__dirname)

describe('@cypress/grep e2e', () => {
let projectPath // = '/private/var/folders/z_/dl76s3pj36z_mbh3sh_9zgs40000gn/T/cy-projects/grep'
describe('@cypress/grep', () => {
let projectPath

before(async () => {
projectPath = await scaffoldGrepProject(cypressGrepPackagePath)

await runCommandInProject(`yarn add @cypress/grep@file:${cypressGrepPackagePath}`, projectPath)
})

it('run Unit Tests', async () => {
await runCommandInProject('npx cypress run --spec cypress/e2e/unit.js --config specPattern="**/unit.js"', projectPath)
})

it('Run e2e tests 🧪', async () => {
await runCommandInProject(`npx cypress-expect --min-passing 5 --pending 0`, projectPath)
})
Expand Down
2 changes: 1 addition & 1 deletion system-tests/projects/grep/cypress/e2e/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
shouldTestRun,
shouldTestRunTags,
shouldTestRunTitle,
} from '../../src/utils'
} from '@cypress/grep/src/utils'

describe('utils', () => {
context('parseTitleGrep', () => {
Expand Down

0 comments on commit 71ee31b

Please sign in to comment.