Angular2 Wallaby config for testing #1144

Closed
opened 2025-08-09 17:19:02 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @bperry77 on 1/2/2017

Has anybody successfully configured wallaby.js in VS code or Visual Studio using the Angular2 SPA?

I think I am close but still getting some errors. Here is my wallaby.js config file:

var webpack = require('webpack');
var wallabyWebpack = require('wallaby-webpack');

var webpackConfig = require('./webpack.config.js')[0];

// Adjust the config as required
// webpackConfig.plugins.push(...);

var normalModuleRepPlugin = new webpack.NormalModuleReplacementPlugin(/.(gif|png|scss|css|html)$/, 'node-noop');

webpackConfig.plugins.push(normalModuleRepPlugin);

var wallabyPostprocessor = wallabyWebpack(webpackConfig);

module.exports = function (wallaby) {
return {
files: [
{ pattern: 'wwwroot/dist/vendor.js', load: false, instrument: false},
{ pattern: 'ClientApp/app//*.ts', load: false, instrument: true},
'!ClientApp/app/
/*.spec.ts'

    ],

    tests: [
        { pattern: 'ClientApp/app/**/*.spec.ts', load: false, instrument: true}
    ],

    postprocessor: wallabyPostprocessor,

    env: {
        type: 'browser'

    },

    setup: function () {
        // required to trigger test loading
        window.__moduleBundler.loadTests();
    }

};

};

I get several runtime errors in the Wallaby.js console:

[Error] Runtime error: ReferenceError: Can't find variable: vendor_d74cddb63548c1c3ebc4​​

Any help would be greatly appreciated.

*Originally created by @bperry77 on 1/2/2017* Has anybody successfully configured [wallaby.js](https://wallabyjs.com/) in VS code or Visual Studio using the Angular2 SPA? I think I am close but still getting some errors. Here is my wallaby.js config file: var webpack = require('webpack'); var wallabyWebpack = require('wallaby-webpack'); var webpackConfig = require('./webpack.config.js')[0]; // Adjust the config as required // webpackConfig.plugins.push(...); var normalModuleRepPlugin = new webpack.NormalModuleReplacementPlugin(/\.(gif|png|scss|css|html)$/, 'node-noop'); webpackConfig.plugins.push(normalModuleRepPlugin); var wallabyPostprocessor = wallabyWebpack(webpackConfig); module.exports = function (wallaby) { return { files: [ { pattern: 'wwwroot/dist/vendor.js', load: false, instrument: false}, { pattern: 'ClientApp/app/**/*.ts', load: false, instrument: true}, '!ClientApp/app/**/*.spec.ts' ], tests: [ { pattern: 'ClientApp/app/**/*.spec.ts', load: false, instrument: true} ], postprocessor: wallabyPostprocessor, env: { type: 'browser' }, setup: function () { // required to trigger test loading window.__moduleBundler.loadTests(); } }; }; I get several runtime errors in the Wallaby.js console: `[Error] Runtime error: ReferenceError: Can't find variable: vendor_d74cddb63548c1c3ebc4​​` Any help would be greatly appreciated.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1144
No description provided.