New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@nx-dotnet/core

Package Overview
Dependencies
Maintainers
1
Versions
231
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nx-dotnet/core - npm Package Compare versions

Comparing version 0.3.0-dev.2 to 0.3.0-dev.3

68

CHANGELOG.md

@@ -0,1 +1,41 @@

# [0.3.0-dev.3](https://github.com/nx-dotnet/nx-dotnet/compare/v0.3.0-dev.2...v0.3.0-dev.3) (2021-04-28)
### Bug Fixes
* **core:** [#20](https://github.com/nx-dotnet/nx-dotnet/issues/20) test template arg cannot be passed from command line ([e9e47e0](https://github.com/nx-dotnet/nx-dotnet/commit/e9e47e01e227f458cef41c3511bba69032dcf449))
* **repo:** semantic-release not updating package.json ([9273001](https://github.com/nx-dotnet/nx-dotnet/commit/9273001d385a3e1da1ed4edcc8411641b5c2e280))
### Features
* **core:** dotnet test support [#20](https://github.com/nx-dotnet/nx-dotnet/issues/20) ([02ceed0](https://github.com/nx-dotnet/nx-dotnet/commit/02ceed0ae846d6a75de03f4fae5c4cb814ca2742))
# [0.3.0-dev.1](https://github.com/nx-dotnet/nx-dotnet/compare/v0.2.1-dev.1...v0.3.0-dev.1) (2021-04-28)
### Bug Fixes
* **core:** [#20](https://github.com/nx-dotnet/nx-dotnet/issues/20) test template arg cannot be passed from command line ([f74900a](https://github.com/nx-dotnet/nx-dotnet/commit/f74900a1eac1d323813fda3f571112137b67c8ef))
* **repo:** semantic-release not updating package.json ([de9fcd9](https://github.com/nx-dotnet/nx-dotnet/commit/de9fcd9cf5accfe99f602a04cbfd9a44f72f1deb))
### Features
* **core:** dotnet test support ([adbb532](https://github.com/nx-dotnet/nx-dotnet/commit/adbb5328b7d80e02418d7b5fbf3aed54b3a0ee33))
## [0.2.1-dev.1](https://github.com/nx-dotnet/nx-dotnet/compare/v0.2.0...v0.2.1-dev.1) (2021-04-27)
### Bug Fixes
* **core:** include serve target only for applications ([#30](https://github.com/nx-dotnet/nx-dotnet/issues/30)) ([d3a54ce](https://github.com/nx-dotnet/nx-dotnet/commit/d3a54cefbd937f2817a676a7d0f3bd449a6f8ced)), closes [#28](https://github.com/nx-dotnet/nx-dotnet/issues/28)
* **core:** output paths still use windows separator on linux / mac ([ed1c53a](https://github.com/nx-dotnet/nx-dotnet/commit/ed1c53af9f703106dbc3abec87424ae149c14feb))
* **core:** use full project path in output directory ([7748f9c](https://github.com/nx-dotnet/nx-dotnet/commit/7748f9cf509d067bbc21867253d1d38bd2795264)), closes [#27](https://github.com/nx-dotnet/nx-dotnet/issues/27)
### Features
* **repo:** enable semantic-release ([298c5af](https://github.com/nx-dotnet/nx-dotnet/commit/298c5afd6c8bf4e09af60a83dfb5bc97a302eaf4))
# [0.3.0-dev.2](https://github.com/nx-dotnet/nx-dotnet/compare/v0.3.0-dev.1...v0.3.0-dev.2) (2021-04-27)

@@ -37,10 +77,26 @@

- **core:** Set output path in generated project files ([96b48f8](https://github.com/nx-dotnet/nx-dotnet/commit/96b48f80054cef14e6185d123b86f96b5f463cb9))
- **core:** tag nx-dotnet projects ([6442d94](https://github.com/nx-dotnet/nx-dotnet/commit/6442d94dd82e30d0b6537e97eddbcccedd799ef9))
- **repo:** enable semantic release ([#26](https://github.com/nx-dotnet/nx-dotnet/issues/26)) ([04b1cbd](https://github.com/nx-dotnet/nx-dotnet/commit/04b1cbdd12160b37d72a6cc0ac69490d334f7cef))
- **repo:** Update build script to utilize Nx's capabilities regarding package.json patching. ([ee80435](https://github.com/nx-dotnet/nx-dotnet/commit/ee80435dad5226f111208c98cd83cc4e3ae66b58))
* **core:** test sr deployment ([fbc5bbf](https://github.com/nx-dotnet/nx-dotnet/commit/fbc5bbf6665a91b44356a518452650596aad3292))
# [0.2.0-dev.2](https://github.com/nx-dotnet/nx-dotnet/compare/v0.2.0-dev.1...v0.2.0-dev.2) (2021-04-26)
### Bug Fixes
- **core:** output paths still use windows separator on linux / mac ([b729fed](https://github.com/nx-dotnet/nx-dotnet/commit/b729fed5116feaeae7bcc13c35aceeed1dbfe16c))
- **core:** packages not published by last CI run ([d07b9f3](https://github.com/nx-dotnet/nx-dotnet/commit/d07b9f306677110c491da2c9a2eb075d79835c1a))
* **core:** output paths still use windows separator on linux / mac ([b729fed](https://github.com/nx-dotnet/nx-dotnet/commit/b729fed5116feaeae7bcc13c35aceeed1dbfe16c))
* **core:** packages not published by last CI run ([d07b9f3](https://github.com/nx-dotnet/nx-dotnet/commit/d07b9f306677110c491da2c9a2eb075d79835c1a))
### Features
* **ci:** fix publish script ([4c6e91a](https://github.com/nx-dotnet/nx-dotnet/commit/4c6e91ab6e9450542f7bbce5c81a5ad482a5aea1))
* **core:** tag nx-dotnet projects ([6442d94](https://github.com/nx-dotnet/nx-dotnet/commit/6442d94dd82e30d0b6537e97eddbcccedd799ef9))
# [0.2.0-dev.1](https://github.com/nx-dotnet/nx-dotnet/compare/v0.1.4...v0.2.0-dev.1) (2021-04-26)
### Features
* **core:** Set output path in generated project files ([96b48f8](https://github.com/nx-dotnet/nx-dotnet/commit/96b48f80054cef14e6185d123b86f96b5f463cb9))
* **repo:** enable semantic-release ([12c223b](https://github.com/nx-dotnet/nx-dotnet/commit/12c223b1ee87137deee7dc9703203c4a8454c200))
* **repo:** Update build script to utilize Nx's capabilities regarding package.json patching. ([ee80435](https://github.com/nx-dotnet/nx-dotnet/commit/ee80435dad5226f111208c98cd83cc4e3ae66b58))
* **repo:** update gh actions for semantic release ([ed933e9](https://github.com/nx-dotnet/nx-dotnet/commit/ed933e977780c6680c6d99ce1a6097aaa1e1b7ea))

6

package.json

@@ -8,4 +8,4 @@ {

"dependencies": {
"@nx-dotnet/dotnet": "0.3.0-dev.2",
"@nx-dotnet/utils": "0.3.0-dev.2",
"@nx-dotnet/dotnet": "0.3.0-dev.3",
"@nx-dotnet/utils": "0.3.0-dev.3",
"glob": "^7.1.6",

@@ -17,3 +17,3 @@ "rimraf": "^3.0.2",

"license": "MIT",
"version": "0.3.0-dev.2",
"version": "0.3.0-dev.3",
"keywords": [

@@ -20,0 +20,0 @@ "Nx",

# NxDotnet
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![Join the chat at https://gitter.im/nx-dotnet-plugin/community](https://badges.gitter.im/nx-dotnet-plugin/community.svg)](https://gitter.im/nx-dotnet-plugin/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Run CI checks](https://github.com/nx-dotnet/nx-dotnet/actions/workflows/main.yml/badge.svg?branch=master)](https://github.com/nx-dotnet/nx-dotnet/actions/workflows/main.yml)

@@ -98,1 +104,23 @@

Visit [Nx Cloud](https://nx.app/) to learn more.
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/agentender"><img src="https://avatars.githubusercontent.com/u/6933928?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Craigory Coppola</b></sub></a><br /><a href="https://github.com/nx-dotnet/nx-dotnet/commits?author=AgentEnder" title="Code">💻</a> <a href="#design-AgentEnder" title="Design">🎨</a> <a href="#ideas-AgentEnder" title="Ideas, Planning, & Feedback">🤔</a></td>
<td align="center"><a href="https://github.com/bcallaghan-et"><img src="https://avatars.githubusercontent.com/u/44448874?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Ben Callaghan</b></sub></a><br /><a href="https://github.com/nx-dotnet/nx-dotnet/commits?author=bcallaghan-et" title="Code">💻</a> <a href="#design-bcallaghan-et" title="Design">🎨</a></td>
<td align="center"><a href="https://github.com/jordan-hall"><img src="https://avatars.githubusercontent.com/u/2092344?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Jordan Hall</b></sub></a><br /><a href="https://github.com/nx-dotnet/nx-dotnet/commits?author=Jordan-Hall" title="Code">💻</a> <a href="#design-Jordan-Hall" title="Design">🎨</a> <a href="#ideas-Jordan-Hall" title="Ideas, Planning, & Feedback">🤔</a></td>
</tr>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

@@ -0,4 +1,6 @@

import { ExecutorContext } from '@nrwl/devkit';
import { DotNetClient } from '@nx-dotnet/dotnet';
import { TestExecutorSchema } from './schema';
export default function runExecutor(options: TestExecutorSchema): Promise<{
export default function runExecutor(options: TestExecutorSchema, context: ExecutorContext, dotnetClient?: DotNetClient): Promise<{
success: boolean;
}>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
function runExecutor(options) {
const dotnet_1 = require("@nx-dotnet/dotnet");
const utils_1 = require("@nx-dotnet/utils");
function runExecutor(options, context, dotnetClient = new dotnet_1.DotNetClient(dotnet_1.dotnetFactory())) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
console.log('Executor ran for Test', options);
const nxProjectConfiguration = utils_1.getExecutedProjectConfiguration(context);
const projectFilePath = yield utils_1.getProjectFileForNxProject(nxProjectConfiguration);
dotnetClient.test(projectFilePath, Object.keys(options).map((x) => ({
flag: x,
value: options[x],
})));
return {

@@ -8,0 +15,0 @@ success: true,

@@ -0,1 +1,8 @@

import { ExecutorContext } from '@nrwl/devkit';
import { mkdirSync, writeFileSync } from 'fs';
import { DotNetClient, mockDotnetFactory } from '@nx-dotnet/dotnet';
import { rimraf } from '@nx-dotnet/utils';
import executor from './executor';

@@ -5,8 +12,48 @@ import { TestExecutorSchema } from './schema';

const options: TestExecutorSchema = {};
const root = process.cwd() + '/tmp';
jest.mock('../../../../dotnet/src/lib/core/dotnet.client');
describe('Test Executor', () => {
it('can run', async () => {
const output = await executor(options);
let context: ExecutorContext;
let dotnetClient: DotNetClient;
beforeEach(() => {
context = {
root: root,
cwd: root,
projectName: 'my-app',
targetName: 'build',
workspace: {
version: 2,
projects: {
'my-app': {
root: `${root}/apps/my-app`,
sourceRoot: `${root}/apps/my-app`,
targets: {
build: {
executor: '@nx-dotnet/core:build',
},
},
},
},
},
isVerbose: false,
};
dotnetClient = new DotNetClient(mockDotnetFactory());
});
afterEach(async () => {
await rimraf(root);
});
it('runs dotnet test', async () => {
const srcRoot = context.workspace.projects['my-app'].sourceRoot as string;
mkdirSync(srcRoot, { recursive: true });
writeFileSync(srcRoot + '/test.csproj', '');
const output = await executor(options, context, dotnetClient);
expect(output.success).toBe(true);
const mock = dotnetClient as jest.Mocked<DotNetClient>;
expect(mock.test).toHaveBeenCalledTimes(1);
});
});

@@ -1,1 +0,34 @@

export interface TestExecutorSchema {} // eslint-disable-line
export interface TestExecutorSchema {
testAdapterPath?: string;
blame?: boolean;
blameCrash?: boolean;
blameCrashDumpType?: string;
blameCrashCollectAlways?: boolean;
blameHang?: boolean;
blameHangDumpType?: string;
blameHangTimeout?: string;
configuration?: string;
collect?: string;
diag?: string;
framework?: string;
filter?: string;
logger?: string;
noBuild?: boolean;
noRestore?: boolean;
output?: string;
resultsDirectory?: string;
runtime?: string;
settings?: string;
listTests?: boolean;
verbosity?:
| 'quiet'
| 'q'
| 'm'
| 'minimal'
| 'n'
| 'normal'
| 'd'
| 'detailed'
| 'diag'
| 'diagnostic';
}

@@ -7,4 +7,109 @@ {

"type": "object",
"properties": {},
"properties": {
"testAdapterPath": {
"description": "Path to a directory to be searched for additional test adapters. Only .dll files with suffix .TestAdapter.dll are inspected. If not specified, the directory of the test .dll is searched.",
"type": "string"
},
"blame": {
"description": "Runs the tests in blame mode. This option is helpful in isolating problematic tests that cause the test host to crash. When a crash is detected, it creates a sequence file in TestResults/<Guid>/<Guid>_Sequence.xml that captures the order of tests that were run before the crash.",
"type": "boolean",
"default": false
},
"blameCrash": {
"description": "Runs the tests in blame mode and collects a crash dump when the test host exits unexpectedly. This option depends on the version of .NET used, the type of error, and the operating system. For exceptions in managed code, a dump will be automatically collected on .NET 5.0 and later versions. It will generate a dump for testhost or any child process that also ran on .NET 5.0 and crashed. Crashes in native code will not generate a dump. This option works on Windows, macOS, and Linux. Crash dumps in native code, or when using .NET Core 3.1 or earlier versions, can only be collected on Windows, by using Procdump. A directory that contains procdump.exe and procdump64.exe must be in the PATH or PROCDUMP_PATH environment variable. Download the tools. Implies --blame. To collect a crash dump from a native application running on .NET 5.0 or later, the usage of Procdump can be forced by setting the VSTEST_DUMP_FORCEPROCDUMP environment variable to 1.",
"type": "boolean",
"default": false
},
"blameCrashDumpType": {
"description": "The type of crash dump to be collected. Implies --blame-crash.",
"type": "string"
},
"blameCrashCollectAlways": {
"description": "Collects a crash dump on expected as well as unexpected test host exit.",
"type": "boolean",
"default": false
},
"blameHang": {
"description": "Run the tests in blame mode and collects a hang dump when a test exceeds the given timeout.",
"type": "boolean",
"default": false
},
"blameHangDumpType": {
"description": "The type of crash dump to be collected. It should be full, mini, or none. When none is specified, test host is terminated on timeout, but no dump is collected. Implies --blame-hang.",
"type": "string"
},
"blameHangTimeout": {
"description": "Per-test timeout, after which a hang dump is triggered and the test host process and all of its child processes are dumped and terminated. The timeout value is specified in one of the following formats: \n 1.5h, 1.5hour, 1.5hours \n 90m, 90min, 90minute, 90minutes \n 5400s, 5400sec, 5400second, 5400seconds \n 5400000ms, 5400000mil, 5400000millisecond, 5400000milliseconds \n When no unit is used (for example, 5400000), the value is assumed to be in milliseconds. When used together with data driven tests, the timeout behavior depends on the test adapter used. For xUnit and NUnit the timeout is renewed after every test case. For MSTest, the timeout is used for all test cases. This option is supported on Windows with netcoreapp2.1 and later, on Linux with netcoreapp3.1 and later, and on macOS with net5.0 or later. Implies --blame and --blame-hang.",
"type": "string"
},
"configuration": {
"description": "Defines the build configuration. The default value is Debug, but your project's configuration could override this default SDK setting.",
"type": "string"
},
"collect": {
"description": "Enables data collector for the test run. For more information, see Monitor and analyze test run. \n To collect code coverage on any platform that is supported by .NET Core, install Coverlet and use the --collect:\"XPlat Code Coverage\" option. \n On Windows, you can collect code coverage by using the --collect \"Code Coverage\" option. This option generates a .coverage file, which can be opened in Visual Studio 2019 Enterprise. For more information, see Use code coverage and Customize code coverage analysis. ",
"type": "string"
},
"diag": {
"description": "Enables diagnostic mode for the test platform and writes diagnostic messages to the specified file and to files next to it. The process that is logging the messages determines which files are created, such as *.host_<date>.txt for test host log, and *.datacollector_<date>.txt for data collector log.",
"type": "string"
},
"framework": {
"description": "Forces the use of dotnet or .NET Framework test host for the test binaries. This option only determines which type of host to use. The actual framework version to be used is determined by the runtimeconfig.json of the test project. When not specified, the TargetFramework assembly attribute is used to determine the type of host. When that attribute is stripped from the .dll, the .NET Framework host is used.",
"type": "string"
},
"filter": {
"description": "Filters out tests in the current project using the given expression. For more information, see the Filter option details section. For more information and examples on how to use selective unit test filtering, see Running selective unit tests.",
"type": "string"
},
"logger": {
"description": "Specifies a logger for test results. Unlike MSBuild, dotnet test doesn't accept abbreviations: instead of -l \"console;v=d\" use -l \"console;verbosity=detailed\". Specify the parameter multiple times to enable multiple loggers.",
"type": "string"
},
"noBuild": {
"description": "Doesn't build the test project before running it. It also implicitly sets the - --no-restore flag.",
"type": "boolean"
},
"noRestore": {
"description": "Doesn't execute an implicit restore when running the command.",
"type": "boolean"
},
"output": {
"description": "Directory in which to find the binaries to run. If not specified, the default path is ./bin/<configuration>/<framework>/. For projects with multiple target frameworks (via the TargetFrameworks property), you also need to define --framework when you specify this option. dotnet test always runs tests from the output directory. You can use AppDomain.BaseDirectory to consume test assets in the output directory.",
"type": "string"
},
"resultsDirectory": {
"description": "The directory where the test results are going to be placed. If the specified directory doesn't exist, it's created. The default is TestResults in the directory that contains the project file.",
"type": "string"
},
"runtime": {
"description": "The target runtime to test for.",
"type": "string"
},
"settings": {
"description": "The .runsettings file to use for running the tests. The TargetPlatform element (x86|x64) has no effect for dotnet test. To run tests that target x86, install the x86 version of .NET Core. The bitness of the dotnet.exe that is on the path is what will be used for running tests. For more information, see the following resources:",
"type": "string"
},
"listTests": {
"description": "List the discovered tests instead of running the tests.",
"type": "boolean"
},
"verbosity": {
"description": "Sets the verbosity level of the command. For more information, see LoggerVerbosity.",
"type": "string",
"enum": [
"quiet",
"q",
"m",
"minimal",
"n",
"normal",
"d",
"detailed",
"diag",
"diagnostic"
]
}
},
"required": []
}

@@ -20,3 +20,3 @@ import { Tree } from '@nrwl/devkit';

template: 'webapi',
'test-template': 'none',
testTemplate: 'none',
skipOutputPathManipulation: true,

@@ -23,0 +23,0 @@ };

@@ -20,3 +20,3 @@ import { Tree } from '@nrwl/devkit';

template: 'classlib',
'test-template': 'none',
testTemplate: 'none',
skipOutputPathManipulation: true,

@@ -23,0 +23,0 @@ };

@@ -40,3 +40,2 @@ "use strict";

return tslib_1.__awaiter(this, void 0, void 0, function* () {
const testName = schema.name + '-test';
const testRoot = schema.projectRoot + '-test';

@@ -70,6 +69,6 @@ const testProjectName = schema.projectName + '-test';

newParams.push({
flag: 'dry-run',
flag: 'dryRun',
});
}
dotnetClient.new(schema['test-template'], newParams);
dotnetClient.new(schema.testTemplate, newParams);
if (!utils_1.isDryRun() && !schema.skipOutputPathManipulation) {

@@ -112,3 +111,3 @@ const testCsProj = yield utils_1.findProjectFileInPath(testRoot);

generator_1.default(host);
options['test-template'] = (_a = options['test-template']) !== null && _a !== void 0 ? _a : 'none';
options.testTemplate = (_a = options.testTemplate) !== null && _a !== void 0 ? _a : 'none';
const normalizedOptions = normalizeOptions(host, options, projectType);

@@ -119,8 +118,7 @@ const projectConfiguration = {

sourceRoot: `${normalizedOptions.projectRoot}`,
targets: Object.assign({ build: models_1.GetBuildExecutorConfiguration(normalizedOptions.projectRoot) }, (projectType === 'application' ? { serve: models_1.GetServeExecutorConfig() } : {})),
targets: Object.assign({ build: models_1.GetBuildExecutorConfiguration(normalizedOptions.projectRoot) }, (projectType === 'application'
? { serve: models_1.GetServeExecutorConfig() }
: {})),
tags: normalizedOptions.parsedTags,
};
if (options['test-template'] !== 'none') {
projectConfiguration.targets.test = models_1.GetTestExecutorConfig(normalizedOptions.projectName + '-test');
}
devkit_1.addProjectConfiguration(host, normalizedOptions.projectName, projectConfiguration);

@@ -143,7 +141,7 @@ const newParams = [

newParams.push({
flag: 'dry-run',
flag: 'dryRun',
});
}
dotnetClient.new(normalizedOptions.template, newParams);
if (options['test-template'] !== 'none') {
if (options['testTemplate'] !== 'none') {
yield GenerateTestProject(normalizedOptions, host, dotnetClient, projectType);

@@ -150,0 +148,0 @@ }

@@ -26,3 +26,3 @@ import { readProjectConfiguration, Tree } from '@nrwl/devkit';

template: 'classlib',
'test-template': 'none',
testTemplate: 'none',
skipOutputPathManipulation: true,

@@ -50,3 +50,3 @@ };

expect(config.targets.serve).not.toBeDefined();
})
});

@@ -81,4 +81,11 @@ it('should tag generated projects', async () => {

expect(config.targets.serve).toBeDefined();
})
});
it('should generate test project', async () => {
options.testTemplate = 'nunit';
await GenerateProject(appTree, options, dotnetClient, 'application');
const config = readProjectConfiguration(appTree, 'test');
expect(config.targets.serve).toBeDefined();
});
/**

@@ -107,3 +114,2 @@ * This test requires a live dotnet client.

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const absoluteDistPath = resolve(config.root, outputPath);

@@ -110,0 +116,0 @@ const expectedDistPath = resolve('./dist/libs/test');

@@ -10,4 +10,4 @@ /**

language: string;
'test-template': 'nunit' | 'mstest' | 'xunit' | 'none';
testTemplate: 'nunit' | 'mstest' | 'xunit' | 'none';
skipOutputPathManipulation: boolean;
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc