dimanche 30 août 2020

Dist folder generates when writing tests

I'm currently trying to write tests for my Meteor app. When I edit any .tests.js file or any file within the ./test directory, a /dist folder generates within the current directory with a matching .dev.js file. I've tested the same packages in separate applications without an issue. Not sure why it might be happening.

I'm working in VSCode.

Meteor version 1.10.2

// meteor packages

meteor-base@1.4.0             
mobile-experience@1.1.0       
mongo@1.10.0                   
reactive-var@1.0.11            

standard-minifier-css@1.6.0   
standard-minifier-js@2.6.0    
es5-shim@4.8.0                
ecmascript@0.14.3              
typescript@3.7.6             
shell-server@0.5.0           

insecure@1.0.7                
react-meteor-data       
accounts-base
accounts-ui
accounts-password
jquery
aldeed:collection2@3.0.0
cultofcoders:grapher
static-html
random
mdg:validated-method
dburles:collection-helpers
meteortesting:mocha
practicalmeteor:chai
dburles:factory
hwillson:stub-collections
// package.json

{
  "name": "proser",
  "private": true,
  "scripts": {
    "start": "meteor run",
    "test": "meteor test --once --driver-package meteortesting:mocha",
    "test-app": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",
    "visualize": "meteor --production --extra-packages bundle-visualizer"
  },
  "dependencies": {
    "@babel/runtime": "^7.10.4",
    "@emotion/core": "^10.0.28",
    "@fortawesome/fontawesome-svg-core": "^1.2.29",
    "@fortawesome/free-solid-svg-icons": "^5.13.1",
    "@fortawesome/react-fontawesome": "^0.1.11",
    "@material-ui/core": "^4.11.0",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/lab": "^4.0.0-alpha.56",
    "bcrypt": "^5.0.0",
    "bootstrap": "^4.5.0",
    "fontsource-roboto": "^2.1.4",
    "formik": "^2.1.4",
    "formik-material-ui": "^3.0.0-alpha.0",
    "history": "^5.0.0",
    "jquery": "^3.5.1",
    "meteor-node-stubs": "^1.0.0",
    "react": "^16.13.0",
    "react-contenteditable": "^3.3.5",
    "react-dom": "^16.13.0",
    "react-quill": "^2.0.0-beta.2",
    "react-router": "^5.2.0",
    "react-router-dom": "^5.2.0",
    "react-spinners": "^0.9.0",
    "simpl-schema": "^1.8.0",
    "yup": "^0.29.1"
  },
  "meteor": {
    "mainModule": {
      "client": "client/main.js",
      "server": "server/main.js"
    },
    "testModule": "tests/main.js"
  }
}
// ./tests/main.js

import assert from "assert";

describe("proser", function () {
  it("package.json has correct name", async function () {
    const { name } = await import("../package.json");
    assert.strictEqual(name, "proser");
  });

  if (Meteor.isClient) {
    it("client is not server", function () {
      assert.strictEqual(Meteor.isServer, false);
    });
  }

  if (Meteor.isServer) {
    it("server is not client", function () {
      assert.strictEqual(Meteor.isClient, false);
    });
  }
});
// ./tests/dist/main.dev.js (generated file)

"use strict";

var _assert = _interopRequireDefault(require("assert"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

describe("proser", function () {
  it("package.json has correct name", function _callee() {
    var _ref, name;

    return regeneratorRuntime.async(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            _context.next = 2;
            return regeneratorRuntime.awrap(Promise.resolve().then(function () {
              return _interopRequireWildcard(require("../package.json"));
            }));

          case 2:
            _ref = _context.sent;
            name = _ref.name;

            _assert["default"].strictEqual(name, "proser");

          case 5:
          case "end":
            return _context.stop();
        }
      }
    });
  });

  if (Meteor.isClient) {
    it("client is not server", function () {
      _assert["default"].strictEqual(Meteor.isServer, false);
    });
  }

  if (Meteor.isServer) {
    it("server is not client", function () {
      _assert["default"].strictEqual(Meteor.isClient, false);
    });
  }
});

Aucun commentaire:

Enregistrer un commentaire