@webex/jsdoctrinetest 2.59.2 → 2.59.3-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/transform.js CHANGED
@@ -1,68 +1,68 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import template from '@babel/template';
6
- import traverse from '@babel/traverse';
7
-
8
- import parse from './parse';
9
- import generateSpec from './mocha-template';
10
- import {build as buildLiteralAssertion, test as literalAssertionTest} from './assertions/literal';
11
-
12
- const assertionStatementTemplate = template(`
13
- return Promise.resolve(ORIGINAL)
14
- .then(function(result) {
15
- ASSERTIONS
16
- })
17
- `);
18
-
19
- /**
20
- * @param {Object} options
21
- * @param {ast} options.comment
22
- * @param {string} options.name
23
- * @param {string} options.filename
24
- * @param {string} options.type
25
- * @returns {ast}
26
- */
27
- export default function transform({comment, name, filename, type}) {
28
- const ast = parse(comment);
29
-
30
- traverse(ast, {
31
- enter(path) {
32
- if (path.node.trailingComments) {
33
- const assertions = path.node.trailingComments.map(makeAsserter);
34
-
35
- if (assertions.length) {
36
- Reflect.deleteProperty(path.node, 'trailingComments');
37
-
38
- path.replaceWith(
39
- assertionStatementTemplate({
40
- ORIGINAL: path.node,
41
- ASSERTIONS: assertions,
42
- })
43
- );
44
- }
45
- }
46
- },
47
- });
48
-
49
- return generateSpec({
50
- testCase: ast,
51
- name,
52
- filename,
53
- type,
54
- });
55
- }
56
-
57
- /**
58
- * Takes a trailing comment from an example block and changes it to an assertion
59
- * @param {CommentBlock} comment
60
- * @returns {ast}
61
- */
62
- function makeAsserter(comment) {
63
- if (literalAssertionTest(comment.value)) {
64
- return buildLiteralAssertion(comment.value);
65
- }
66
-
67
- return null;
68
- }
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import template from '@babel/template';
6
+ import traverse from '@babel/traverse';
7
+
8
+ import parse from './parse';
9
+ import generateSpec from './mocha-template';
10
+ import {build as buildLiteralAssertion, test as literalAssertionTest} from './assertions/literal';
11
+
12
+ const assertionStatementTemplate = template(`
13
+ return Promise.resolve(ORIGINAL)
14
+ .then(function(result) {
15
+ ASSERTIONS
16
+ })
17
+ `);
18
+
19
+ /**
20
+ * @param {Object} options
21
+ * @param {ast} options.comment
22
+ * @param {string} options.name
23
+ * @param {string} options.filename
24
+ * @param {string} options.type
25
+ * @returns {ast}
26
+ */
27
+ export default function transform({comment, name, filename, type}) {
28
+ const ast = parse(comment);
29
+
30
+ traverse(ast, {
31
+ enter(path) {
32
+ if (path.node.trailingComments) {
33
+ const assertions = path.node.trailingComments.map(makeAsserter);
34
+
35
+ if (assertions.length) {
36
+ Reflect.deleteProperty(path.node, 'trailingComments');
37
+
38
+ path.replaceWith(
39
+ assertionStatementTemplate({
40
+ ORIGINAL: path.node,
41
+ ASSERTIONS: assertions,
42
+ })
43
+ );
44
+ }
45
+ }
46
+ },
47
+ });
48
+
49
+ return generateSpec({
50
+ testCase: ast,
51
+ name,
52
+ filename,
53
+ type,
54
+ });
55
+ }
56
+
57
+ /**
58
+ * Takes a trailing comment from an example block and changes it to an assertion
59
+ * @param {CommentBlock} comment
60
+ * @returns {ast}
61
+ */
62
+ function makeAsserter(comment) {
63
+ if (literalAssertionTest(comment.value)) {
64
+ return buildLiteralAssertion(comment.value);
65
+ }
66
+
67
+ return null;
68
+ }
@@ -1,11 +1,11 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import {assert} from '@webex/test-helper-chai';
6
-
7
- describe('jsdoctrinetest', () => {
8
- it('has just enough of a test suite to not crash the test suite', () => {
9
- assert.isTrue(true);
10
- });
11
- });
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import {assert} from '@webex/test-helper-chai';
6
+
7
+ describe('jsdoctrinetest', () => {
8
+ it('has just enough of a test suite to not crash the test suite', () => {
9
+ assert.isTrue(true);
10
+ });
11
+ });