Skip to content

Commit

Permalink
Added obj and bin ignore for Cake Frosting Integration Tests
Browse files Browse the repository at this point in the history
cake.test.ts Reorder imports to previious commit

Signed-off-by: Fischer, Louis <louisfischer@gmail.com>

Update __tests__/cake.test.ts

Co-authored-by: Enrico Campidoglio <enrico.campidoglio@gmail.com>
Moved variable per suggestion

cake-build#46 (comment)

action.ts Reorder imports to previous commit

Change the Verbosity Flag to -v to only the .net project references it.

Rebuild the index.js file with changes

Unit Tests fixed

Removed verbosity flag

Use -- to separate cake-frosting params from dotnet run
  • Loading branch information
louisfischer authored and ecampidoglio committed Apr 15, 2024
1 parent 046b3c7 commit d6f1335
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,9 @@ typings/

# Secret files
.secrets

# bin folder
bin/

# obj folder
obj/
13 changes: 7 additions & 6 deletions __tests__/cake.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
import * as path from 'path';
import { exec } from '@actions/exec';
import { which } from '@actions/io';
import * as path from 'path';

import * as cake from '../src/cake';
import { CakeArgument, CakeSwitch } from '../src/cakeParameter';
import { CakeToolSettings } from '../src/cakeToolSettings';
import { ToolsDirectory } from '../src/toolsDirectory';
import { CakeToolSettings } from '../src/cakeToolSettings';
import { CakeArgument, CakeSwitch } from '../src/cakeParameter';

const pathToLocalToolsDirectory = path.join('path', 'to', 'tool');
const pathToLocalTool = path.join(pathToLocalToolsDirectory, 'dotnet-cake');
const dotnetManifestCake = 'dotnet tool run dotnet-cake';
const pathToCsprojFile = path.join('build', 'Build.csproj');
const dotnetManifestCake = 'dotnet tool run dotnet-cake';
const dotnetRun = 'dotnet run';

jest.mock('@actions/exec');
Expand Down Expand Up @@ -212,6 +211,7 @@ describe('When running a Cake Frosting project successfully', () => {
'--no-launch-profile',
'--verbosity', 'minimal',
'--configuration', 'Release',
'--',
`--paths_tools="${fakeToolsDirectory.path}"`
]);
});
Expand All @@ -230,6 +230,7 @@ describe('When running a Cake Frosting project successfully', () => {
'--no-launch-profile',
'--verbosity', 'minimal',
'--configuration', 'Release',
'--',
`--paths_tools="${fakeToolsDirectory.path}"`,
'--param=arg',
'--switch'
Expand All @@ -244,7 +245,7 @@ describe('When failing to run a Cake Frosting Project', () => {
fakeExec.mockReturnValue(Promise.resolve(-21));
});

test('it should throw error when csproj-path does not exist', async () => {
test('it should throw an error containing the exit code', async () => {
await expect(cake.runProject('', new ToolsDirectory())).rejects.toThrow('-21');
});
});
19 changes: 10 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4096,6 +4096,7 @@ function runProject(csprojPath, toolsDir, ...params) {
'--no-launch-profile',
'--verbosity', 'minimal',
'--configuration', 'Release',
'--',
`--paths_tools="${toolsDir}"`,
...cakeParams
]);
Expand Down Expand Up @@ -4454,13 +4455,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = void 0;
const core = __importStar(__nccwpck_require__(2186));
const action = __importStar(__nccwpck_require__(7672));
const cake = __importStar(__nccwpck_require__(9275));
const cakeTool = __importStar(__nccwpck_require__(4574));
const toolsDirectory_1 = __nccwpck_require__(6745);
const cakeToolSettings_1 = __nccwpck_require__(6881);
const dotnet = __importStar(__nccwpck_require__(9870));
const guards_1 = __nccwpck_require__(3265);
const toolsDirectory_1 = __nccwpck_require__(6745);
const dotnet = __importStar(__nccwpck_require__(9870));
const cakeTool = __importStar(__nccwpck_require__(4574));
const cake = __importStar(__nccwpck_require__(9275));
const action = __importStar(__nccwpck_require__(7672));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
Expand All @@ -4474,16 +4475,16 @@ function run() {
const cakeToolSettings = new cakeToolSettings_1.CakeToolSettings(toolsDir, (version === null || version === void 0 ? void 0 : version.version) === 'tool-manifest');
dotnet.disableTelemetry();
dotnet.disableWelcomeMessage();
if (!csprojPath) {
if (csprojPath) {
yield cake.runProject(csprojPath, toolsDir, ...inputs.scriptArguments);
}
else {
yield cakeTool.install(toolsDir, version);
if (bootstrap === 'explicit') {
yield cake.bootstrapScript(scriptPath, cakeToolSettings);
}
yield cake.runScript(scriptPath, cakeToolSettings, ...inputs.scriptArguments);
}
else {
yield cake.runProject(csprojPath, toolsDir, ...inputs.scriptArguments);
}
}
catch (error) {
if ((0, guards_1.isError)(error)) {
Expand Down
1 change: 0 additions & 1 deletion src/action.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as core from '@actions/core';

import * as script from './cakeParameter';
import * as input from './input';

Expand Down
1 change: 1 addition & 0 deletions src/cake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export async function runProject(
'--no-launch-profile',
'--verbosity', 'minimal',
'--configuration', 'Release',
'--',
`--paths_tools="${toolsDir}"`,
...cakeParams
]);
Expand Down

0 comments on commit d6f1335

Please sign in to comment.