1
0

Switch to ESM

This commit is contained in:
Eugen Wissner 2024-12-20 15:03:16 +01:00
parent 53e4c5dba6
commit 738f4f2bdb
Signed by: belka
GPG Key ID: A27FDC1E8EE902C0
22 changed files with 10709 additions and 5148 deletions

View File

@ -4,6 +4,9 @@ import axios from 'axios'
When('I request the same resource twice', async function () {
const url = 'http://localhost:8080/'
this.first = await axios.request(url).data
this.second = await axios.request(url).data
const firstResponse = await axios.request(url)
this.first = firstResponse.data
const secondResponse = await axios.request(url)
this.second = secondResponse.data
})

View File

@ -21,5 +21,9 @@ When('I request the same resource three times', function () {
Then('the responses should be the same', function () {
expect(this.first).to.equal(this.second)
if (this.third === undefined) {
return
}
expect(this.second).to.equal(this.third)
})

View File

@ -1,7 +0,0 @@
module.exports = {
presets: [
[ '@babel/env', {
useBuiltIns: 'usage'
}]
]
}

View File

@ -1,4 +1,4 @@
import { Given, When, Then } from 'cucumber'
import { Given, When, Then } from '@cucumber/cucumber'
import { expect } from 'chai'
Given('the following books by Simon Frank are in the collection:', function (dataTable) {

File diff suppressed because it is too large Load Diff

View File

@ -3,17 +3,14 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "cucumber-js --require-module '@babel/register'"
"test": "cucumber-js"
},
"author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0",
"dependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.4",
"chai": "^4.2.0",
"cucumber": "^5.0.3"
"@cucumber/cucumber": "^11.1.1",
"chai": "^5.1.2"
}
}

View File

@ -1,5 +1,5 @@
const { Given, When, Then } = require('cucumber')
const assert = require('assert')
import { Given, When, Then } from '@cucumber/cucumber'
import assert from 'assert'
Given('the numbers:', function (dataTable) {
this.numbers = dataTable.rows()[0]

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,14 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "cucumber-js --format usage",
"json": "cucumber-js --format json"
},
"author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0",
"devDependencies": {
"cucumber": "^5.0.3"
"dependencies": {
"@cucumber/cucumber": "^11.1.1"
}
}

View File

@ -1,7 +0,0 @@
module.exports = {
presets: [
[ '@babel/env', {
useBuiltIns: 'usage'
}]
]
}

View File

@ -1,4 +1,4 @@
import { Before, Given, Then } from 'cucumber'
import { Before, Given, Then } from '@cucumber/cucumber'
import { expect } from 'chai'
import _ from 'lodash'

View File

@ -1,4 +1,4 @@
import { Before, Given, Then } from 'cucumber'
import { Before, Given, Then } from '@cucumber/cucumber'
import { expect } from 'chai'
import R from 'ramda'

View File

@ -1,4 +1,4 @@
import { Before, Given, Then } from 'cucumber'
import { Before, Given, Then } from '@cucumber/cucumber'
import { expect } from 'chai'
function step (name) {

View File

@ -1,4 +1,4 @@
import { setWorldConstructor } from 'cucumber'
import { setWorldConstructor } from '@cucumber/cucumber'
setWorldConstructor(function () {
this.names = []

3925
reuse/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,21 +3,18 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "cucumber-js --require-module '@babel/register'"
"test": "cucumber-js"
},
"author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0",
"devDependencies": {
"@babel/core": "^7.2.2",
"@babel/preset-env": "^7.2.3",
"@babel/register": "^7.0.0",
"babel-loader": "^8.0.4",
"chai": "^4.2.0",
"cucumber": "^5.1.0"
"chai": "^5.1.2"
},
"dependencies": {
"@cucumber/cucumber": "^11.1.1",
"lodash": "^4.17.11",
"ramda": "^0.26.1"
"ramda": "^0.30.1"
}
}

View File

@ -1,4 +1,4 @@
import { When, Then } from 'cucumber';
import { When, Then } from '@cucumber/cucumber';
import { expect } from 'chai';
When('the step definitions are written in {word}', function (language: string) {

2937
ts/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -3,15 +3,19 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "cucumber-js --require-module 'ts-node/register' --require 'features/**/*.ts'"
"test": "cucumber-js --loader 'ts-node/esm' --import 'features/**/*.ts'"
},
"author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0",
"dependencies": {
"chai": "^4.2.0",
"cucumber": "^5.0.3",
"ts-node": "^7.0.1",
"typescript": "^3.2.2"
"@cucumber/cucumber": "^11.1.1",
"chai": "^5.1.2",
"ts-node": "^10.9.2",
"typescript": "^5.7.2"
},
"devDependencies": {
"@types/chai": "^5.0.1"
}
}

View File

@ -1,5 +1,5 @@
const { Before, Given, When, Then, defineParameterType } = require('cucumber')
const { expect } = require('chai')
import { Before, Given, When, Then, defineParameterType } from '@cucumber/cucumber'
import { expect } from 'chai'
defineParameterType({
name: 'tobe',
@ -39,7 +39,7 @@ Before(function () {
this.count = 0
})
Given(/(a regular expression|it) matches (this|that) pattern/, function (_, _) {
Given(/(a regular expression|it) matches (this|that) pattern/, function (_x, _y) {
++this.count
})

File diff suppressed because it is too large Load Diff

View File

@ -3,13 +3,16 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "cucumber-js"
},
"author": "Eugen Wissner <belka@caraus.de>",
"license": "MPL-2.0",
"devDependencies": {
"chai": "^4.2.0",
"cucumber": "^5.0.3"
"chai": "^5.1.2"
},
"dependencies": {
"@cucumber/cucumber": "^11.1.1"
}
}