menu

Imba

The language for building next-gen web applications

Channels
Team

How to setup Cypress with Imba

November 3, 2019 at 8:42pm

November 3, 2019 at 8:48pm
I put a webpack.config file in the cypress folder
module.exports = {
module: {
rules: [{
test: /\.imba$/,
loader: 'imba/loader',
}]
},
resolve: {
extensions: [".imba",".js", ".json"]
}
}
  • reply
  • like
And in the cypress/plugins folder
const webpack = require('@cypress/webpack-preprocessor')
module.exports = (on) => {
const options = {
webpackOptions: require('../webpack.config'),
watchOptions: {},
}
on('file:preprocessor', webpack(options))
}
Edited
  • reply
  • like
But when I try to run integration/test.imba, I got this message:
./cypress/integration/test.imba 2:1
Module parse failed: Unexpected token (2:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| class Test
> prop a123
|
|
@ multi ./cypress/integration/test.imba main[0]
  • reply
  • like
I don't know much about Webpack or Cypress. It is possible to do some webpack magic to write cypress test with Imba?
  • reply
  • like
I just forgot tonpm install --save-dev /webpack-preprocessor Now is working
extern describe, it, cy
describe :test, do
it 'works', do
console.log("o/")
  • reply
  • like