зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1473295 - add enviroment for unit tests, r=jdescottes,ladybenko
Differential Revision: https://phabricator.services.mozilla.com/D32959 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bd1d104ad9
Коммит
ae788a0773
|
@ -6,5 +6,5 @@
|
|||
|
||||
module.exports = {
|
||||
// Extend from the shared list of defined globals for mochitests.
|
||||
"extends": "../../../.eslintrc.mochitests.js"
|
||||
"extends": "../../../.eslintrc.mochitests.js",
|
||||
};
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
"plugins": ["@babel/plugin-proposal-async-generator-functions"],
|
||||
};
|
|
@ -0,0 +1,69 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Dummy test shallow renders a component 1`] = `
|
||||
<article
|
||||
className="worker-list-empty"
|
||||
>
|
||||
<Localized
|
||||
a={
|
||||
<a
|
||||
className="external-link"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
}
|
||||
id="serviceworker-empty-intro"
|
||||
>
|
||||
<h1
|
||||
className="worker-list-empty__title"
|
||||
/>
|
||||
</Localized>
|
||||
<Localized
|
||||
id="serviceworker-empty-suggestions"
|
||||
>
|
||||
<p />
|
||||
</Localized>
|
||||
<ul
|
||||
className="worker-list-empty__tips"
|
||||
>
|
||||
<Localized
|
||||
a={
|
||||
<a
|
||||
className="link"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
}
|
||||
id="serviceworker-empty-suggestions-console"
|
||||
>
|
||||
<li
|
||||
className="worker-list-empty__tips__item"
|
||||
/>
|
||||
</Localized>
|
||||
<Localized
|
||||
a={
|
||||
<a
|
||||
className="link"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
}
|
||||
id="serviceworker-empty-suggestions-debugger"
|
||||
>
|
||||
<li
|
||||
className="worker-list-empty__tips__item"
|
||||
/>
|
||||
</Localized>
|
||||
<Localized
|
||||
a={
|
||||
<a
|
||||
className="link js-trusted-link"
|
||||
onClick={[Function]}
|
||||
/>
|
||||
}
|
||||
id="serviceworker-empty-suggestions-aboutdebugging"
|
||||
>
|
||||
<li
|
||||
className="worker-list-empty__tips__item"
|
||||
/>
|
||||
</Localized>
|
||||
</ul>
|
||||
</article>
|
||||
`;
|
|
@ -0,0 +1,22 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* eslint-env jest */
|
||||
const { shallow } = require("enzyme");
|
||||
const React = require("react");
|
||||
|
||||
const WorkerListEmpty = require("devtools/client/application/src/components/WorkerListEmpty");
|
||||
const WorkerListEmptyComp = React.createFactory(WorkerListEmpty);
|
||||
|
||||
/**
|
||||
* Dummy test to check if setup is working + we render one component
|
||||
*/
|
||||
|
||||
describe("Dummy test", () => {
|
||||
it("shallow renders a component", () => {
|
||||
const wrapper = shallow(WorkerListEmptyComp({}));
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -0,0 +1,11 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
Cc: {},
|
||||
Ci: {},
|
||||
Cu: {},
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports.PluralForm = {
|
||||
get(num, str) {
|
||||
return str;
|
||||
},
|
||||
};
|
|
@ -0,0 +1,9 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {
|
||||
appinfo: "",
|
||||
};
|
|
@ -0,0 +1,23 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
"use strict";
|
||||
|
||||
// @TODO Load the actual strings from instead.
|
||||
class L10N {
|
||||
getStr(str) {
|
||||
switch (str) {
|
||||
default:
|
||||
return str;
|
||||
}
|
||||
}
|
||||
|
||||
getFormatStr(str) {
|
||||
return this.getStr(str);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
L10N: new L10N(),
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
module.exports = {};
|
|
@ -0,0 +1,26 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* global __dirname */
|
||||
|
||||
module.exports = {
|
||||
verbose: true,
|
||||
moduleNameMapper: {
|
||||
// Custom name mappers for modules that require m-c specific API.
|
||||
"^../utils/l10n": `${__dirname}/fixtures/l10n`,
|
||||
"^devtools/client/shared/link": `${__dirname}/fixtures/stub`,
|
||||
"^devtools/shared/plural-form": `${__dirname}/fixtures/plural-form`,
|
||||
"^chrome": `${__dirname}/fixtures/Chrome`,
|
||||
"^Services": `${__dirname}/fixtures/Services`,
|
||||
// Map all require("devtools/...") to the real devtools root.
|
||||
"^devtools\\/(.*)": `${__dirname}/../../../$1`,
|
||||
},
|
||||
setupFiles: [
|
||||
"<rootDir>setup.js",
|
||||
],
|
||||
snapshotSerializers: [
|
||||
"enzyme-to-json/serializer",
|
||||
],
|
||||
};
|
|
@ -0,0 +1,22 @@
|
|||
{
|
||||
"name": "application-panel-tests",
|
||||
"license": "MPL-2.0",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"node": ">=8.9.4"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"test-ci": "jest --json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-async-generator-functions": "^7.2.0",
|
||||
"enzyme": "^3.9.0",
|
||||
"enzyme-adapter-react-16": "^1.13.2",
|
||||
"enzyme-to-json": "^3.3.5",
|
||||
"jest": "^24.6",
|
||||
"react": "16.4.1",
|
||||
"react-dom": "16",
|
||||
"react-test-renderer": "16.4.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||
|
||||
"use strict";
|
||||
|
||||
/* global global */
|
||||
|
||||
// Configure enzyme with React 16 adapter.
|
||||
const Enzyme = require("enzyme");
|
||||
const Adapter = require("enzyme-adapter-react-16");
|
||||
Enzyme.configure({ adapter: new Adapter() });
|
||||
|
||||
global.loader = {
|
||||
lazyGetter: (context, name, fn) => {
|
||||
const module = fn();
|
||||
global[name] = module;
|
||||
},
|
||||
lazyRequireGetter: (obj, property, module, destructure) => {
|
||||
Object.defineProperty(obj, property, {
|
||||
get: () => {
|
||||
// Redefine this accessor property as a data property.
|
||||
// Delete it first, to rule out "too much recursion" in case obj is
|
||||
// a proxy whose defineProperty handler might unwittingly trigger this
|
||||
// getter again.
|
||||
delete obj[property];
|
||||
const value = destructure
|
||||
? require(module)[property]
|
||||
: require(module || property);
|
||||
Object.defineProperty(obj, property, {
|
||||
value,
|
||||
writable: true,
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
return value;
|
||||
},
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
});
|
||||
},
|
||||
lazyImporter: () => {},
|
||||
};
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,5 +1,6 @@
|
|||
browser/components/translation/cld2/
|
||||
devtools/client/aboutdebugging-new/test/jest/node_modules/
|
||||
devtools/client/application/test/node_modules/
|
||||
devtools/client/debugger/node_modules/
|
||||
devtools/client/shared/build/babel.js
|
||||
devtools/client/shared/sourceeditor/codemirror/
|
||||
|
|
Загрузка…
Ссылка в новой задаче