Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
841 views
in Technique[技术] by (71.8m points)

environment variables - Wallaby.js not working (Cannot find module '../../config-test.json' from 'node_modules/cpm-config.app.js')

I have join a new organization recently, and I am trying to configure my machine.

As I am a huge fan of Wallaby.js, I'd like to make it work on my setup.

But I can't set the env params correctly.

Here is my wallaby.js file :

'use strict'

module.exports = function () {
    process.env.NODE_ENV = 'ci'
    return {
        files: ['src/**/*.js'],

        tests: ['tests/**/*Spec.js'],
        env: {
            type: 'node',
        },
    }
}
question from:https://stackoverflow.com/questions/65916490/wallaby-js-not-working-cannot-find-module-config-test-json-from-node-m

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I guess you already solved your problem but in case somebody has the same. The problem comes from the configuration you have a wallaby.js Done like that means that wallaby will only consider js files with this pattern: tests/**/*Spec.js

Since your configuration file do not have Spec in the name it is not loaded by wallaby.js

To fix that simply put this as a pattern for the test files: tests/**/*.js


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...