jlengstorf / learn-rollup

This is an example project to accompany a tutorial on using Rollup.
https://code.lengstorf.com/learn-rollup-js/
ISC License
191 stars 61 forks source link

js test #36

Closed idavollen closed 7 years ago

idavollen commented 7 years ago

Hi,

I tried to run js test with your code by adding a array.spec.js under app-root/test: import addArray from '../src/modules/mod2';

describe('Object History API Testing', function() {

    it('Updating history should change history', function() {
      var res = addArray([1, 2, 3, 4]);
      expect(res).toBe(10);
    });

});

and change a bit in package.json

"test": "cross-env BABEL_ENV=commonjs jest"

added corresponding dependencies, however, it failed with such an error message: SyntaxError: Unexpected token import

Do you have any idea on it? Or can you add some js test code for the purpose as example?

Thanks in advance!

jlengstorf commented 7 years ago

@idavollen I just added a new branch called alt-config/jest with Jest configuration and tests for the two modules. Check out the diff to see how I approached configuration — there's a little bit of env-specific .babelrc stuff that's required.

idavollen commented 7 years ago

@jlengstorf Thanks for your great work!