• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nguyenhuuit / adventofcode-runner / #4

10 Jun 2025 04:49PM UTC coverage: 9.492%. Remained the same
#4

push

nguyenhuuit
ci: publish coverage

20 of 137 branches covered (14.6%)

Branch coverage included in aggregate %.

36 of 453 relevant lines covered (7.95%)

0.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/hooks/useExecutionStore.ts
1
import { StoreApi, UseBoundStore, create } from 'zustand';
2

3
import { EXTENSIONS } from '@utils/languages';
4

5
interface ExecutionState {
6
  year: string;
7
  day: string;
8
  part: string;
9
  language: string;
10
  baseDir: string;
11
  inputMode: string;
12
  output: string;
13
  answer: string;
14
  perfLog: string;
15
  loading: boolean;
16
}
17

18
interface ExecutionActions {
19
  setInputMode: StringFunction;
20
  setPart: StringFunction;
21
  setOutput: StringFunction;
22
  clearOutput: Function;
23
  appendOutput: StringFunction;
24
  setAnswer: StringFunction;
25
  setPerfLog: StringFunction;
26
  setLoading: BooleanFunction;
27
  getRelativeDir: () => string;
28
  getSolutionFile: () => string;
29
  getInputFile: () => string;
30
}
31

32
export type ExecutionStore = ExecutionState & ExecutionActions;
33

34
export type ExecutionStoreInstance = UseBoundStore<StoreApi<ExecutionStore>>;
35

36
export const createExecutionStore = (promptInput: Required<PromtOptions> & { baseDir: string }) =>
×
37
  create<ExecutionStore>((set, get) => ({
×
38
    inputMode: 'sample',
39
    output: '',
40
    answer: '',
41
    perfLog: '',
42
    loading: false,
43
    ...promptInput,
44
    setInputMode: (inputMode) => set({ inputMode }),
×
45
    setPart: (part) => set({ part }),
×
46
    setOutput: (output) => set({ output }),
×
47
    clearOutput: () => set({ output: '' }),
×
48
    appendOutput: (output) => set((state) => ({ output: state.output + output })),
×
49
    setAnswer: (answer) => set({ answer }),
×
50
    setPerfLog: (perfLog) => set({ perfLog }),
×
51
    setLoading: (loading) => set({ loading }),
×
52
    getRelativeDir: () => `./${get().year}/day${get().day}/`,
×
53
    getSolutionFile: () =>
54
      `./${get().year}/day${get().day}/part${get().part}.${EXTENSIONS[get().language]}`,
×
55
    getInputFile: () => `./${get().year}/day${get().day}/${get().inputMode}.txt`,
×
56
  }));
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc