functional.test.js.tpl 687 B

123456789101112131415161718192021
  1. import {
  2. runWebpackExampleInMemory,
  3. } from '../test/test-utils';
  4. test('should run with no errors or warnings', async () => {
  5. const buildStats = await runWebpackExampleInMemory('simple');
  6. const { errors, warnings } = buildStats;
  7. expect([...errors, ...warnings].length).toBe(0);
  8. });
  9. test('should append transformations to JavaScript module', async () => {
  10. const buildStats = await runWebpackExampleInMemory('simple');
  11. const { modules } = buildStats;
  12. const moduleToTest = modules[0].source()._source._value;
  13. const loadedString = '* Original Source From Loader';
  14. expect(moduleToTest).toEqual(expect.stringContaining(loadedString));
  15. expect(moduleToTest).toMatchSnapshot();
  16. });